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

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.

主站蜘蛛池模板: 嵊州市| 宜宾县| 台山市| 沁水县| 龙海市| 汕头市| 湘乡市| 大安市| 墨脱县| 酒泉市| 札达县| 凤凰县| 海淀区| 安陆市| 嘉荫县| 太仆寺旗| 乐安县| 辽宁省| 丰原市| 义乌市| 嘉荫县| 都昌县| 定南县| 湘潭县| 宜章县| 平定县| 图片| 大宁县| 高台县| 麻江县| 夏邑县| 大邑县| 新竹县| 泰和县| 科尔| 将乐县| 昭平县| 自治县| 札达县| 台东县| 高州市|