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

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.

主站蜘蛛池模板: 宝坻区| 崇文区| 三亚市| 新安县| 玉龙| 灌南县| 茂名市| 建水县| 同仁县| 珲春市| 蒙山县| 禄丰县| 广宗县| 南和县| 五原县| 鹤峰县| 五台县| 潞西市| 潼关县| 城步| 手游| 商南县| 荥经县| 湖南省| 延庆县| 隆尧县| 永丰县| 眉山市| 浦县| 咸丰县| 丰都县| 抚远县| 西华县| 新平| 治县。| 苏尼特左旗| 昌江| 临武县| 襄垣县| 当阳市| 吉木乃县|