What is the unit for the Spring actuator http.server.requests statistic

依然范特西╮ 提交于 2021-02-10 00:22:49

问题


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.

A sample output of the endpoint is:

{
    "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"
            ]
        }
    ]
}

回答1:


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

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.

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.

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



来源:https://stackoverflow.com/questions/49304995/what-is-the-unit-for-the-spring-actuator-http-server-requests-statistic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!