Micrometer JMX

Micrometer provides a hierarchical mapping to JMX, primarily as a cheap and portable way to view metrics locally. Where JMX exporting is found in production, the same metrics are generally exported to another, more purpose-fit monitoring system.

1. Installing micrometer-registry-jmx

For Gradle, add the following implementation:

implementation 'io.micrometer:micrometer-registry-jmx:latest.release'

For Maven, add the following dependency:


Micrometer also sometimes scrapes data from JMX beans for use in reporting metrics. This registry implementation is not needed for these uses. Rather, this module is strictly used to export data to JMX.

2. Hierarchical name mapping

Micrometer provides a HierarchicalNameMapper interface that governs how a dimensional meter ID is mapped to flat hierarchical names.

The default (HierarchicalNameMapper.DEFAULT) sorts tags alphabetically by key and appends tag key/value pairs to the base meter name with '.' — for example, http_server_requests.method.GET.response.200. The name and tag keys have the registry’s naming convention applied to them first.

If there is something special about your naming scheme that you need to honor, you can provide your own HierarchicalNameMapper implementation. The most common cause of a custom mapper comes from a need to prefix something to the front of every metric (generally something like app.<name>.http_server_requests.method.GET.response.200).

3. Counters

JMX counters measure mean throughput and one-, five-, and fifteen-minute exponentially-weighted moving average throughputs.

JMX-rendered counter
Figure 1. The JMX rendered values of the random walk counter.