官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 阳东县| 泽普县| 民勤县| 潞西市| 河津市| 阿克陶县| 莫力| 台中县| 方正县| 宕昌县| 珲春市| 喀喇| 石屏县| 滨州市| 水城县| 四川省| 临沧市| 辛集市| 慈利县| 平南县| 武鸣县| 正镶白旗| 财经| 交城县| 舟曲县| 阿鲁科尔沁旗| 芜湖县| 万宁市| 鲜城| 通道| 枣强县| 德昌县| 白城市| 神农架林区| 新邵县| 宜昌市| 隆德县| 磐石市| 五台县| 衡东县| 新津县|