- 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.
推薦閱讀
- 新編Visual Basic程序設計上機實驗教程
- Android Jetpack開發(fā):原理解析與應用實戰(zhàn)
- Go語言高效編程:原理、可觀測性與優(yōu)化
- Responsive Web Design with HTML5 and CSS3
- 深入淺出Windows API程序設計:編程基礎篇
- Programming with CodeIgniterMVC
- Django 3.0入門與實踐
- 小型編譯器設計實踐
- Flowable流程引擎實戰(zhàn)
- Xcode 6 Essentials
- LabVIEW數(shù)據(jù)采集
- 從零開始學Python大數(shù)據(jù)與量化交易
- Python 3快速入門與實戰(zhàn)
- 深入理解Java虛擬機:JVM高級特性與最佳實踐
- Building Clouds with Windows Azure Pack