Chapter 6. Understanding Micrometer integration
Micrometer is a vendor-neutral observability facade that provides a reusable API for registering and recording application performance metrics. In JBoss EAP XP 6.0, you can integrate Micrometer so that applications can expose custom metrics and the server can publish metrics by using supported registries.
The extension is not enabled by default. You must add the extension and the subsystem, and you must configure at least one registry. ping endpoint, or both concurrently if your observability strategy requires it.
6.1. Adding Micrometer subsystem using the Management CLI Copy linkLink copied to clipboard!
The Micrometer subsystem enhances monitoring capabilities in JBoss EAP by facilitating comprehensive metrics gathering and publication. However, the org.jboss.extension.micrometer subsystem is available to all standalone configurations within the JBoss EAP distribution, but it must be added manually.
Prerequisites
- JBoss EAP 8.1 with JBoss EAP XP 6.0 is installed.
- You have access to the JBoss EAP management CLI and permissions to make configuration changes.
Procedure
- Open your terminal.
Connect to the server by running the following command:
$ ./jboss-cli.sh --connectCheck if the Micrometer extension is already added to the configuration by running the following command:
[standalone@localhost:9990 /] /extension=org.wildfly.extension.micrometer:read-resourceIf the Micrometer extension is not available, add it by running the following command:
[standalone@localhost:9990 /] /extension=org.wildfly.extension.micrometer:add()Add the Micrometer subsystem with the required configuration. For example, specify the endpoint URL of the metrics collector by running the following command:
[standalone@localhost:9990 /] /subsystem=micrometer:add()Reload the server to apply the changes:
[standalone@localhost:9990 /] reload
6.2. Configuring the OpenTelemetry (OTLP) exporter Copy linkLink copied to clipboard!
You can configure Micrometer to export metrics to an OpenTelemetry (OTLP) collector endpoint.
Prerequisite
- JBoss EAP 8.1 with JBoss EAP XP 6.0 is installed.
- You have access to the JBoss EAP management CLI and permissions to make configuration changes.
- You have configured the Micrometer extension and subsystem, as described in Adding the Micrometer subsystem by using the management CLI.
Procedure
Connect to the server using the management CLI:
$ ./jboss-cli.sh --connectConfigure the Micrometer subsystem with the OTLP collector endpoint:
If the Micrometer subsystem is not present, add it and set the OTLP collector endpoint:
/subsystem=micrometer:add(endpoint="http://localhost:4318/v1/metrics")If the Micrometer subsystem already exists, update it to use the OTLP collector endpoint:
/subsystem=micrometer:write-attribute(name=endpoint,value="http://localhost:4318/v1/metrics")
Reload the server to apply changes:
reload
When the collector is not running or its collector endpoint is unavailable, then a warning message similar to the following is triggered:
11:28:16,581 WARNING [io.micrometer.registry.otlp.OtlpMeterRegistry] (MSC service thread 1-5) Failed to publish metrics to OTLP receiver: java.net.ConnectException: Connection refused
6.3. Configuring the Prometheus registry in JBoss EAP XP 6.0 Copy linkLink copied to clipboard!
In JBoss EAP XP 6.0, Prometheus configuration is managed exclusively through system properties. These properties can be set through the command line when starting the server, or persisted in the server configuration using the management CLI. Please note that this might change in a future release.
Use the Prometheus registry to expose a scrape endpoint on the management interface.
Prerequisites
- Access to the management CLI.
- You have configured the Micrometer extension and subsystem, as described in Adding the Micrometer subsystem by using the management CLI.
Procedure
Add the Prometheus registry and set the HTTP context path:
/system-property=org.jboss.eap.xp.micrometer.prometheus.context:add(value="/metrics")(Optional) Verify or change endpoint security (enabled by default):
By default, the endpoint requires authentication with a management user account, that is, the same credentials that you use to access the management CLI. To disable this authentication requirement, set the following system property:
/system-property=org.jboss.eap.xp.micrometer.prometheus.security-enabled:add(value=false)Reload the server:
reload
6.4. Removing the WildFly metrics subsystem Copy linkLink copied to clipboard!
After you configure Micrometer to publish metrics for your applications, the WildFly metrics subsystem is no longer required. Both subsystems can collect overlapping metrics, and if Micrometer is configured to expose a metrics endpoint, you may also end up with multiple endpoints. To avoid duplication and simplify the configuration, you can remove the legacy metrics subsystem.
Follow this procedure to remove the WildFly metrics subsystem when you use Micrometer for metrics collection.
Prerequisites
- Access to the management CLI.
Procedure
Remove the WildFly metrics subsystem and extension, then reload:
/subsystem=metrics:remove /extension=org.wildfly.extension.metrics:remove reload
6.5. Disabling OpenTelemetry metrics when using Micrometer Copy linkLink copied to clipboard!
If you use OpenTelemetry for tracing or logging, and Micrometer for metrics, disable OpenTelemetry metrics to avoid duplication.
Prerequisites
- Access to the management CLI.
Procedure
Set the
otel.metrics.exportersystem property to none and reload:/system-property=otel.metrics.exporter:add(value=none) reloadOr configure the property in MicroProfile Config:
otel.metrics.exporter=none