Skip to content

Latest commit

 

History

History

micro-metrics

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Dropwizard metrics plugin for Microserver

micro-metrics example apps

This adds support for Dropwizard metrics annotations on Spring beans. For more detailed info see Metrics Spring

To use

Maven Central

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'

Configuring Metrics Reporters

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));

An example Spring Bean capturing Metrics

@Component
public class TimedResource {

	
	@Timed
	public String times(){

		return "ok!";
	}
}