This adds support for Dropwizard metrics annotations on Spring beans. For more detailed info see Metrics Spring
Simply add to the classpath
Maven
<dependency>
<groupId>com.oath.microservices</groupId>
<artifactId>micro-metrics</artifactId>
<version>x.yz</version>
</dependency>
Gradle
compile 'com.oath.microservices:micro-metrics:x.yz'
By default we report to the console hourly and to JMX. To configure other reporters, this can be done via the setInit method on the CodahaleMetricsConfigurer class e.g.
CodahaleMetricsConfigurer.setInit( metricRegistry ->
TestReporter.forRegistry(metricRegistry)
.build()
.start(10, TimeUnit.MILLISECONDS));
@Component
public class TimedResource {
@Timed
public String times(){
return "ok!";
}
}