【问题标题】:HTTP metrics per endpoint uri in spring boot appSpring Boot 应用程序中每个端点 uri 的 HTTP 指标
【发布时间】:2021-08-03 17:00:10
【问题描述】:

我为我的项目启用了执行器。我对我的应用程序中每个端点 uri 的指标感兴趣。

我有两个端点//hello。当我访问/actuator/metrics/http.server.requests 时,我得到以下结果:

{
  "name": "http.server.requests",
  "description": null,
  "baseUnit": "seconds",
  "measurements": [
    {
      "statistic": "COUNT",
      "value": 11
    },
    {
      "statistic": "TOTAL_TIME",
      "value": 0.07724317
    },
    {
      "statistic": "MAX",
      "value": 0.024692496
    }
  ],
  "availableTags": [
    {
      "tag": "exception",
      "values": [
        "None"
      ]
    },
    {
      "tag": "method",
      "values": [
        "POST",
        "GET"
      ]
    },
    {
      "tag": "uri",
      "values": [
        "/actuator/metrics/{requiredMetricName}",
        "/actuator/health",
        "/**",
        "/hello",
        "/"
      ]
    },
    {
      "tag": "outcome",
      "values": [
        "CLIENT_ERROR",
        "SUCCESS"
      ]
    },
    {
      "tag": "status",
      "values": [
        "404",
        "200"
      ]
    }
  ]
}

但是我对每个端点 //hello 的指标感兴趣,例如平均响应时间、最大值、最小值等信息。

这个有配置参数吗?以上仅提供了一个汇总的指标信息。我想查看每个端点指标。

【问题讨论】:

    标签: spring spring-boot metrics spring-boot-actuator


    【解决方案1】:

    您可以使用标签来获取汇总结果,例如,如果您只想获取 /hello 的指标,您可以请求:

    /actuator/metrics/http.server.requests?tag=uri:/hello
    

    并且您可以组合标签,例如,如果您想获取对 /hello 发出的所有返回 200 的请求的指标,您可以请求:

    /actuator/metrics/http.server.requests?tag=uri:/hello&tag=status:200
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-26
      • 1970-01-01
      • 2019-07-24
      • 2019-04-02
      • 2022-10-08
      • 2023-01-30
      • 2018-11-16
      • 2021-07-15
      相关资源
      最近更新 更多