- 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.
推薦閱讀
- Data Visualization with D3 4.x Cookbook(Second Edition)
- Raspberry Pi for Python Programmers Cookbook(Second Edition)
- Building a RESTful Web Service with Spring
- Python計算機視覺編程
- PHP+MySQL+Dreamweaver動態網站開發實例教程
- Full-Stack React Projects
- The DevOps 2.5 Toolkit
- R用戶Python學習指南:數據科學方法
- Swift 4從零到精通iOS開發
- Java 從入門到項目實踐(超值版)
- Struts 2.x權威指南
- Clojure Polymorphism
- Python Web自動化測試設計與實現
- Java高手是怎樣煉成的:原理、方法與實踐
- JavaScript Concurrency