|
For the latest stable version, please use Micrometer 1.17.1! |
Micrometer Graphite
Graphite is one of the most popular current hierarchical metrics systems backed by a fixed-size database, similar in design and purpose to RRDtool. It originated at Orbitz in 2006 and was open sourced in 2008.
1. Installing
For Gradle, add the following implementation:
implementation 'io.micrometer:micrometer-registry-graphite:latest.release'
For Maven, add the following dependency:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-graphite</artifactId>
<version>${micrometer.version}</version>
</dependency>
2. Configuring
The following example configures a Graphite instance:
GraphiteConfig graphiteConfig = new GraphiteConfig() {
@Override
public String host() {
return "mygraphitehost";
}
@Override
public String get(String k) {
return null; // accept the rest of the defaults
}
};
MeterRegistry registry = new GraphiteMeterRegistry(graphiteConfig, Clock.SYSTEM, HierarchicalNameMapper.DEFAULT);
Micrometer uses Dropwizard Metrics as the underlying instrumentation library when recording metrics destined for Graphite. GraphiteConfig 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, Spring Boot’s Micrometer support binds its application properties directly to the