[17.0.0.3 and later]

Monitoring with MicroProfile metrics

You can use the mpMetrics-1.0 or the mpMetrics-1.1 feature to monitor applications that are instrumented with the MicroProfile metrics API. The mpMetrics-1.0 and the mpMetrics-1.1 features provide a /metrics REST interface that conforms to the MicroProfile metrics 1.0 or MicroProfile metrics 1.1 specification. Application developers can add their own custom metrics, by using the MicroProfile metrics API, alongside the metrics provided by Liberty.

Before you begin

To browse the MicroProfile metrics 1.0 specification, see Metrics for Eclipse MicroProfile 1.0 specification.

[18.0.0.1 and later]To browse the MicroProfile metrics 1.1 specification, see Metrics for Eclipse MicroProfile 1.1 specification.

Procedure

  1. Configure the feature. Add the mpMetrics-1.0 or the mpMetrics-1.1 feature to the feature manager in the server.xml file. The mpMetrics-1.0 or the mpMetrics-1.1 feature requires also that you secure the REST API. The following example illustrates a basic security setup. MicroProfile metrics use the default keystore to secure the endpoint.
    <featureManager>
      <feature>mpMetrics-1.0</feature>                  
    </featureManager>
    
    <quickStartSecurity userName="theUser" userPassword="thePassword"/>
    <keyStore id="defaultKeyStore" password="Liberty"/>
  2. Set up monitoring tools to monitor data from /metrics.

    The default format for responses to requests to /metrics is a text format compatible with Prometheus. Responses to requests made to /metrics with an accept header of application/json are provided in a JSON output format. See MicroProfile metrics REST API.


Icon that indicates the type of topic Task topic

File name: twlp_mp_metrics_monitor.html