Building custom metrics

Just like health, customization of the metrics is also possible. The following example shows how to add a counter service and gauge service, just for demonstration purpose:

    @Autowired   
CounterService counterService;

@Autowired
GaugeService gaugeService;

And add the following methods to the greet method:

    this.counterService.increment("greet.txnCount");      
this.gaugeService.submit("greet.customgauge", 1.0);

Restart the server, and go to /application/metrics to see the new gauge and counter added already reflected there.