Search code examples
jmxdropwizardmetrics

Dropwizard @Timer annotation does not work for classes other than resources


I am using JMX reporting for my dropwizard application. I initialize it as:

JmxReporter.forRegistry(this.registry).convertRatesTo(TimeUnit.SECONDS).build().start()

When I use the @Timed annotation, the methods in the resources are timed and metrics are reported. However, all the other classes that use @Timed annotation are not metered (or the metrics are not pushed). I checked this by starting jconsole and listing the beans pushed to JMX server.

How to get the @Timed annotation to work with other classes as well?


Solution

  • Using com.palominolabs.metrics:metrics-guice worked.