简体   繁体   English

如何使用弹簧启动执行器分别捕获给定REST端点的GET,POST和PUT方法的度量

[英]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,我需要

  1. "gauge.response.customer.GET": 631, OR "gauge.response.GET.customer": 631, “ gauge.response.customer.GET”:631,或“ gauge.response.GET.customer”:631,
  2. "gauge.response.customer.POST": 1631, OR "gauge.response.POST.customer": 1631 “ gauge.response.customer.POST”:1631,或“ gauge.response.POST.customer”:1631

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.

相关问题 在 spring 引导 rest 中使用 POST 方法更新 object 的特定数据 - update specific data for an object using POST method in spring boot rest 如何使用 Spring Boot 在 API Get 方法 Endpoint 中传递多个 id - How to pass multiple ids in API Get method Endpoint using Spring Boot 使用 Spring Boot 对 REST API 的 GET/POST 请求 - GET/POST Requst to REST API using Spring Boot 如何使用 curl 将 CSV 文件发布到弹簧休息端点 - How to post a CSV file to a spring rest endpoint using curl 测试Spring Boot Rest API的Post方法 - Test the Spring Boot Rest API Post Method 如何使用REST方法和REST方法获取REST API终结点的访问令牌,当前出现404错误? - How to get the access token of REST API endpoint using Rest Assured with POST method, Currently I am getting 404 error? spring boot rest api的指标 - Metrics for spring boot rest api 普罗米修斯端点中缺少 Spring Boot Webclient 指标 - Spring Boot Webclient metrics missing in prometheus endpoint 只有 Post REST api 有效,PUT、GET、DELETE api 在 spring 启动应用程序中不起作用 - Only Post REST api is working , PUT,GET,DELETE api's are not working in spring boot application Spring Boot:计算页面浏览量-执行器 - Spring Boot : Count Page Views - Actuators
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM