Spring执行器http.server.requests统计的单位是什么

问题描述:

我使用 spring-boot-starter-2.0.0.RELEASE 实现了服务.我已经为它启用了执行器指标,但是我无法理解所呈现的指标是什么单位.具体来说,我对 http.server.requests 感兴趣.

I have service implemented with spring-boot-starter-2.0.0.RELEASE. I have enabled actuator metrics for it, however I cannot understand what units are the metrics presented in. Specifically, I am interested in the http.server.requests.

端点的示例输出是:

{
    "name": "http.server.requests",
    "measurements": [
        {
            "statistic": "COUNT",
            "value": 2
        },
        {
            "statistic": "TOTAL_TIME",
            "value": 0.049653001
        },
        {
            "statistic": "MAX",
            "value": 0.040696019
        }
    ],
    "availableTags": [
        {
            "tag": "exception",
            "values": [
                "None"
            ]
        },
        {
            "tag": "method",
            "values": [
                "GET"
            ]
        },
        {
            "tag": "status",
            "values": [
                "200"
            ]
        }
    ]
}

截至目前(Spring-Boot:2.0.0 和 Micrometer:1.0.2)不幸的答案是:这取决于.

As of now (Spring-Boot:2.0.0 and Micrometer:1.0.2) the unfortunate answer is: It depends.

/actuator/metrics 端点由应用程序中当前活动的 MeterRegistry 实现支持.此实现定义了呈现定时信息的基本时间单位.例如.如果您的类路径中只有 micrometer-registry-prometheus/acturor/metrics 端点将在 .如果你有例如micromter-registry-graphite,端点将服务于 毫秒(它由 DropwizardMeterRegistry 支持.).如果您没有吸引到特殊的"MeterRegistry 实现,SimpleMeterRegistry 将成为支持注册中心,并将 服务秒.

The /actuator/metrics endpoint is backed by the currently active MeterRegistry implementation in your application. This implementation defines the base-unit of time in which the timed information is presented. E.g. if you got micrometer-registry-prometheus in your classpath only, the /acturor/metrics endpoint will serve timing information in seconds. If you got e.g. micromter-registry-graphite, the endpoint will serve in milliseconds (It's backed by DropwizardMeterRegistry.). If you got no "special" MeterRegistry implementation attracted, the SimpleMeterRegistry will become the backing registry and will serve seconds.

更糟糕的是,如果您有多个 MeterRegistry 实现,则将选择使用 CompositeMeterRegistry 注册的第一个实现作为支持 MeterRegistrycode>/actuator/metrics 端点.

To make things a little worse, if you got multiple MeterRegistry implementations aboard, the first implementation registered with the CompositeMeterRegistry will be chosen as the backing implementation which serves the /actuator/metrics endpoint.

免责声明:信息是从/与jkschneider收集的,Micrometer的维护者.

Disclaimer: The information has been collected from/with jkschneider, the maintainer of Micrometer.