Spring Boot has preconfigured metrics. As I know it uses http://metrics.codahale.com/ library. How can I get MetricRegistry
object to add my custom metrics?
Spring boot now supports Codahale Metrics out of the box.
See http://docs.spring.io/spring-boot/docs/1.0.0.RC5/reference/htmlsingle/#production-ready-code-hale-metrics
Spring Boot Does not use Codahale Metrics (yet). The plan is to support it as an option if it is on the classpath. If you prefer to do it that way then a MetricRegistry
will be in the application context and you can simply @Autowire
it and use it. You can see that work in progress on a branch in my fork.
The Boot interfaces for adding metrics are GaugeService
and CounterService
. You inject those and use them to record measurements. When Codahale gets support then this will be the recommended entry point for that as well, so you can get started using it now and add the Codahale stuff later if you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With