For the latest stable version, please use Micrometer 1.14.1!

Micrometer KairosDB

KairosDB is a dimensional time-series database built on top of Cassandra. Charting can be accomplished in Grafana by using a Kairos datasource.

1. Installing

For Gradle, add the following implementation:

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

For Maven, add the following dependency:

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

2. Configuring

The following example configures KairosDB:

KairosConfig kairosConfig = new KairosConfig() {
    @Override
    @Nullable
    public String get(String k) {
        return null;
    }
};
MeterRegistry registry = new KairosMeterRegistry(kairosConfig, Clock.SYSTEM);

KairosConfig 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.kairos directly to the KairosConfig:

management.metrics.export.kairos:
    # You will probably want disable Kairos publishing in a local development profile.
    enabled: true

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

    # Authentication may be required, depending on how you have Kairos configured
    user-name: MYUSER
    password: MYPASSWORD