[英]Exposing percentile values of micrometer timer in springboot /metrics
I currently have a spring boot 2.4.0 project which exposes metrics with /metrics/custom-timer, I created a custom timer but it only gives some values but not the percentiles.我目前有一个 spring 启动 2.4.0 项目,它使用 /metrics/custom-timer 公开指标,我创建了一个自定义计时器,但它只给出一些值而不是百分位数。
"name": "custom-timer",
"description": null,
"base_unit": "seconds",
"measurements": [
{
"statistic": "COUNT",
"value": 1000.0
},
{
"statistic": "TOTAL_TIME",
"value": 100000.0
},
{
"statistic": "MAX",
"value": 100.0
}
],
"available_tags": []
}
I initiated the custom timer as我将自定义计时器启动为
summary = Timer.builder("custom-timer")
.publishPercentileHistogram(true)
.publishPercentiles(0.3, 0.5, 0.95)
.register(Metrics.globalRegistry);
How to get the percentile values in metrics endpoint?如何获取指标端点中的百分位值?
Spring Boot Actuator's /metrics
endpoint does not support percentiles (it uses SimpleMeterRegistry
under the hood). Spring 引导执行器的
/metrics
端点不支持百分位数(它在后台使用SimpleMeterRegistry
)。 This is mostly because this endpoint is not meant to be used to pull production metrics from it, it is just for informational/debugging purposes.这主要是因为此端点不用于从中提取生产指标,它仅用于信息/调试目的。
You can add a "real" registry and you should see the percentiles (eg: Prometheus: /actuator/prometheus
).您可以添加一个“真实”注册表,您应该会看到百分位数(例如:Prometheus:
/actuator/prometheus
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.