I want to use Spring Boot MetricsWriter
to write / export data from my Spring Boot application to a data source of my choice (say - Jmx / Graphite). I can use JmxReporter
/ GraphiteReporter
, but I believe Spring abstraction Writer
/ Exporter
can play a vital role in terms of changing the data source later.
REST endpoint annotated with Dropwizard annotations
@Timed(absolute=true, name="invokeEndpoint")
public ResponseEntity<Object> callSomeApi() {
...
}
My configuration class is as follows:
@Configuration
public class SpringBootMetrics {
@Bean
@ExportMetricReader
public MetricReader metricReader() {
return new MetricRegistryMetricReader(metricRegistry());
}
public MetricRegistry metricRegistry() {
final MetricRegistry metricRegistry = new MetricRegistry();
return metricRegistry;
}
@Bean
@ExportMetricWriter
MetricWriter metricWriter(MBeanExporter exporter) {
return new JmxMetricWriter(exporter);
}
}
I don't see any metrics for calling the endpoint being collected in Jmx via jconsole. What am I missing?