Skip to content

Capturing Metrics with Codahale

johnmcclean-aol edited this page Dec 10, 2015 · 2 revisions

By default Microserver will capture Metrics using Codahale Metrics, integrated with Spring via Ryan Tenney's awesome Metrics-Spring library. By default Metrics are available via JMX as MBeans, or are reported hourly to the console.

To change the default configuration initialisation Consumer on CodahaleMetricsConfigurer to one that configures Codahale Metrics in the desired way. Default configuration is

     (metricRegistry)-> {
		
		JmxReporter.forRegistry(metricRegistry) .build()
        .start();
		
		 ConsoleReporter
         .forRegistry(metricRegistry)
         .build()
         .start(1, TimeUnit.HOURS);
	};

To switch off Metrics reporting entirely call

      CodahaleMetricsConfigurer.switchOff()