简体   繁体   English

在 springboot /metrics 中暴露千分尺计时器的百分位值

[英]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.

相关问题 Springboot:千分尺指标未显示 - Springboot: micrometer metrics not showing up 使用Micrometer指标运行SpringBoot 2应用程序时出错 - Error when running SpringBoot 2 application with Micrometer metrics 在 Java springboot 应用程序中使用千分尺收集 HikariCp 指标,方法是在 - HikariCp metrics collection using micrometer in Java springboot application by configuring it in 自 SpringBoot 2.3.x 以来,千分尺中缺少 kafka 指标 - kafka metrics missing in micrometer since SpringBoot 2.3.x 带弹簧靴和千分尺的百分位数 - Percentile with spring boot and micrometer micrometer 公开执行器指标 vs kube-state-metrics vs metrics-server 以设置 pod 请求/限制 - micrometer exposing actuator metrics vs kube-state-metrics vs metrics-server to set pod request/limits 如何使用 Micrometer 格式和 /actuator/prometheus 将 Apache Camel 指标(如 metrics:timer:simple.timer)输出到 Prometheus - How to output Apache Camel metrics like metrics:timer:simple.timer to Prometheus using Micrometer format with /actuator/prometheus 在 Spring 微米中为端点启用指标 - Enable metrics for endpoints in Spring micrometer 使用Micrometer为InfluxDB指标设置通用标签 - Setting common tags with Micrometer for InfluxDB metrics 如何在运行的微服务中禁用/启用千分尺指标 - How to disable/enable Micrometer metrics in running microservice
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM