Search code examples
spring-bootcodahale-metrics

Trying to integrate Coda Hale Metrics in spring boot, not seing the metrics in /metrics


I have followed the indication that adding the coda hale metrics library into the classpath would automatically autoconfigure the metrics.

That works, I get the injected metricRegistry bean.

However, how to I expose these new metrics in the /metrics endpoint?

Thanks!


Solution

  • That's not the way it's supposed to work. Codahale has some metric types that do not map to Spring Boot ones, so you are supposed to use the Codahale native APIs for reporting once you start collecting metrics that way. Boot is only providing the service abstraction for Gauge and Counter at that point.

    UPDATE: Spring Boot also adds Codahale metrics to the /metrics endpoint since 1.2.0 (see MetricRegistryMetricReader).