[英]How to capture metrics Separately for GET,POST and PUT method for given REST Endpoint using spring boot actuators
How to capture metrics Separately for GET,POST and PUT method for given REST Endpoint using spring boot actuators. 如何使用弹簧启动执行器分别捕获给定REST端点的GET,POST和PUT方法的度量。
Ex 防爆
by default we get :- "gauge.response.customer": 631, i need 默认情况下,我们得到:-“ gauge.response.customer”:631,我需要
Thanks in advance 提前致谢
Hmm I do not believe you can break the endpoints down like that. 嗯,我不认为您可以像这样分解端点。 However, I do know that actuator is very flexible and you can add new metrics to that endpoint. 但是,我知道执行器非常灵活,您可以向该端点添加新指标。 It looks like you are interested primarily in counters so I would recommend using the CounterService that Spring boot has. 看来您主要对计数器感兴趣,所以我建议您使用Spring引导所提供的CounterService。
private CounterService counterService;
@Autowired
public MyClassName(CounterService counterService) {
this.counterService = counterService;
}
@RequestMapping(method=RequestMethod.POST)
public String myPostMethod(Object obj) {
counterService.increment("mycontroller.post.method");
//...
return "myPostMethod";
}
@RequestMapping(method=RequestMethod.GET)
public String myGetMethod() {
counterService.increment("mycontroller.get.method");
//...
return "myGetMethod";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.