Monitoring Micrometer

Supported Versions

Confirmed support for custom metrics for versions 1.0.0+.

Sensor (Data Collection)

Micrometer is a simple application metrics facade for the JVM. It has become the defacto standard in the Java ecosystem and is integrated into SpringBoot. Read more on Micrometer at micrometer.io.

Instana supports Micrometer without any additional configuration. The sensor detects Micrometer usage and automatically collects metrics. No additional Maven dependency needed!

A Micrometer MeterRegistry is only discovered when a public method is called on the MeterRegistry object once the JVM is instrumented. Initializing a metric registry using a public constructor is usually the only public method executed before the Instana agent starts. Therefore, as soon as any MeterRegistry's public method gets called after the agent is started, the agent will be able to discover the registry.

All metric graphs will show up on the JVM dashboard.

Configuration

If the JVM has the Micrometer metrics library loaded, custom metrics are automatically collected and displayed at the bottom of the JVM's dashboard. To prevent the backend from overloading, there is a default limit of 200 metrics per JVM.

To disable Micrometer monitoring or to change the limit of metrics being gathered, use the following configuration:

com.instana.plugin.java:
  micrometerMetricCollection:
    enabled: false
    limit: 200

If the metrics are not displayed even though the library is loaded, consider registering your io.micrometer.core.instrument.MeterRegistry instance as the default one. For example:

import io.micrometer.core.instrument.Metrics;

Metrics.globalRegistry.add(meterRegistry)

Metrics

The sensor gathers all types of metrics:

Metric type Description
Counter The cumulative count since this counter was created
DistributionSummary The total amount of all recorded events
FunctionCounter The cumulative count since this counter was created
FunctionTimer The total time of all occurrences of the timed event
Gauge The current value
LongTaskTimer The current number of tasks being executed
Timer The total time of recorded events scaled to milliseconds
TimeGauge The current value, scaled to the appropriate base unit

More details for Micrometer metrics.

Metric names contain concatenated tags in form of tag_name=tag_value. Eg. in the following screenshot tags are:

exception=None, method=GET, outcome=SUCCESS, 
status=200, version=1.0, maintainer=instana

Timer metric

Metric whose names start with "jvm", "process", "tomcat", "system", "logback" are automatically excluded from monitoring.

Micrometer Prometheus Registry

The Prometheus Meter Registry is a sub-project in the Micrometer ecosystem for exporting metric data in Prometheus format. If you are using this extension and want to keep your current metric format, you can integrate Instana's Prometheus Java Client Library monitoring. However, this requires adding a line of code, as described on github.com/instana/prometheus-java-library-integration.