- Spring 5.0 Microservices(Second Edition)
- Rajesh R V
- 66字
- 2021-07-02 19:45:06
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.
推薦閱讀
- ASP.NET Core:Cloud-ready,Enterprise Web Application Development
- Docker and Kubernetes for Java Developers
- Computer Vision for the Web
- Internet of Things with the Arduino Yún
- CKA/CKAD應試教程:從Docker到Kubernetes完全攻略
- C語言程序設計學習指導與習題解答
- Jupyter數據科學實戰
- UVM實戰
- Extending Puppet(Second Edition)
- Java程序設計入門
- Android項目實戰:手機安全衛士開發案例解析
- Visual Basic程序設計(第三版)
- Python數據可視化之美:專業圖表繪制指南(全彩)
- 和孩子一起學編程:用Scratch玩Minecraft我的世界
- Hands-On ROS for Robotics Programming