简体   繁体   English

向 Spring Boot 2 指标添加“平均值”、“最小值”或“百分位数”?

[英]Adding 'mean', 'min' or 'percentiles' to Spring Boot 2 metrics?

I am using the new MicroMeter metrics in Spring Boot 2 version 2.0.0-RELEASE .我在Spring Boot 2版本2.0.0-RELEASE中使用新的MicroMeter指标。

When publishing metrics over the /actuator/metrics/{metric.name} endpoint, i get the following:通过/actuator/metrics/{metric.name}端点发布指标时,我得到以下信息:

For a DistributionSummary :对于DistributionSummary

"name": "sources.ingestion.rate",
    "measurements": [
        {
           "statistic": "COUNT",
            "value": 5
        },
        {
            "statistic": "TOTAL",
            "value": 72169.44162067816
        },
        {
            "statistic": "MAX",
            "value": 17870.68010661754
        }
    ],
    "availableTags": []
}

For a Timer :对于Timer

{
    "name": "sources.ingestion",
    "measurements": [
        {
            "statistic": "COUNT",
            "value": 5
        },
        {
            "statistic": "TOTAL_TIME",
            "value": 65.700878648
        },
        {
            "statistic": "MAX",
            "value": 22.661545322
        }
    ],
    "availableTags": []
}

Is it possible to enrich the measurements to add measures like mean , min , or percentiles ?是否可以丰富测量以添加诸如meanminpercentiles之类的度量?

For percentiles i tried using .publishPercentiles(0.5, 0.95) , but that doesn't reflect on the actuator endpoint.对于百分位数,我尝试使用.publishPercentiles(0.5, 0.95) ,但这并没有反映在执行器端点上。

Now you can implement percentiles-histogram like this:现在你可以像这样实现百分位数直方图:

  metrics:
    distribution:
      percentiles-histogram:
        http.server.requests: true

Then you can see histogram data in /actuator/prometheus, but can not see in /metrics.那么在/actuator/prometheus中可以看到直方图数据,在/metrics中看不到。 Because it Weill generate only for endpoint which supports histogram.因为它 Weill 只为支持直方图的端点生成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM