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

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.

主站蜘蛛池模板: 昌邑市| 雷州市| 麻江县| 甘孜| 凭祥市| 阜平县| 阿拉善右旗| 菏泽市| 菏泽市| 九寨沟县| 贵州省| 曲麻莱县| 日土县| 台北市| 宁安市| 兴国县| 扶绥县| 上思县| 长治市| 鹤壁市| 桃源县| 连平县| 贵阳市| 扶绥县| 横山县| 高邑县| 新津县| 江津市| 南溪县| 乐陵市| 南川市| 当阳市| 台前县| 宜昌市| 永吉县| 库车县| 竹北市| 会同县| 广宁县| 闵行区| 天水市|