This version is still in development and is not considered stable yet. For the latest stable version, please use Micrometer 1.14.0!

Micrometer Azure Monitor

Azure Monitor is a dimensional time-series SaaS with built-in dashboarding.

1. Installing

For Gradle, add the following implementation:

implementation 'io.micrometer:micrometer-registry-azure-monitor:latest.release'

For Maven, add the following dependency:

<dependency>
  <groupId>io.micrometer</groupId>
  <artifactId>micrometer-registry-azure-monitor</artifactId>
  <version>${micrometer.version}</version>
</dependency>

2. Configuring

The following example configures a Micrometer Azure Monitor:

AzureMonitorConfig azureMonitorConfig = new AzureMonitorConfig() {
    @Override
    public String instrumentationKey() {
        return MY_KEY;
    }

    @Override
    public String get(String key) {
        return null;
    }
};
MeterRegistry registry = new AzureMonitorMeterRegistry(azureMonitorConfig, Clock.SYSTEM);

AzureMonitorConfig is an interface with a set of default methods. If, in the implementation of get(String k), rather than returning null, you instead bind it to a property source, you can override the default configuration. For example, Micrometer’s Spring Boot support binds properties that are prefixed with management.metrics.export.azure-monitor directly to the AzureMonitorConfig:

management.metrics.export.azure-monitor:
    instrumentation-key: YOURKEY

    # You will probably want disable Azure Monitor publishing in a local development profile.
    enabled: true

    # The interval at which metrics are sent to Azure Monitor. The default is 1 minute.
    step: 1m