Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
383 views
in Technique[技术] by (71.8m points)

java - Spring Boot Actuator - MAX property

I am using Spring Boot Actuator dependency to get insights of application. For that, I have used Spring Boot Admin. Configuration for client-server is working fine. I have to measure the count, total-time, max for endpoints which are going to execute.

uri:/user/asset/getAllAssets
TOTAL_TIME: 831ms
MAX: 0ms 

uri:/user/getEmployee/{employeeId}
TOTAL_TIME: 98ms
MAX: 0ms

Why MAX (time) is 0 while TOTAL_TIME: is Xms

Spring Boot Admin Image

While I execute generalize form

localhost:8889/actuator/metrics/http.server.requests I get the MAX as 3.00..

I had also seen production-ready-features but not able to find any description about how MAX is calculated or what does it represent

Notes: with the number of request in an increase, COUNT, TOTAL_TIME is also getting an increase but MAX is reducing sometimes (see Request 1, Request 2 for details)

Request 1: http.server.requests

 {
        "name": "http.server.requests",
        "description": null,
        "baseUnit": "seconds",
        "measurements": [
            {
                "statistic": "COUNT",
                "value": 597
            },
            {
                "statistic": "TOTAL_TIME",
                "value": 144.9057076
            },
            {
                "statistic": "MAX",
                "value": 3.0002913
            }
        ],
        "availableTags": [
            {
                "tag": "exception",
                "values": [
                    "None"
                ]
            },
            {
                "tag": "method",
                "values": [
                    "GET"
                ]
            },
            {
                "tag": "uri",
                "values": [
                    "/actuator/metrics/{requiredMetricName}",
                    "/**/favicon.ico",
                    "/actuator",
                    "/user/getEmployee/{employeeId}",
                    "/user/asset/getAllAssets",
                    "/actuator/health",
                    "/actuator/info",
                    "/actuator/env/{toMatch}",
                    "/actuator/metrics",
                    "/**"
                ]
            },
            {
                "tag": "outcome",
                "values": [
                    "CLIENT_ERROR",
                    "SUCCESS"
                ]
            },
            {
                "tag": "status",
                "values": [
                    "404",
                    "200"
                ]
            }
        ]
    }

UPDATE

localhost:8889/actuator/metrics/http.server.requests?tag=uri:/user/getEmployee/2

Response 404 (I have executed /user/getEmployee/2 before making a request for actuator)


localhost:8889/actuator/metrics/http.server.requests?tag=uri:/user/getEmployee/{employeeId}

Response 400


localhost:8889/actuator/metrics/http.server.requests?tag=uri:/user/asset/getAllAssets

{
    "name": "http.server.requests",
    "description": null,
    "baseUnit": "seconds",
    "measurements": [
        {
            "statistic": "COUNT",
            "value": 1
        },
        {
            "statistic": "TOTAL_TIME",
            "value": 0.8311609
        },
        {
            "statistic": "MAX",
            "value": 0
        }
    ],
    "availableTags": [
        {
            "tag": "exception",
            "values": [
                "None"
            ]
        },
        {
            "tag": "method",
            "values": [
                "GET"
            ]
        },
        {
            "tag": "outcome",
            "values": [
                "SUCCESS"
            ]
        },
        {
            "tag": "status",
            "values": [
                "200"
            ]
        }
    ]
}

Request 2: http.server.requests

localhost:8889/actuator/metrics/http.server.requests

{
    "name": "http.server.requests",
    "description": null,
    "baseUnit": "seconds",
    "measurements": [
        {
            "statistic": "COUNT",
            "value": 3346
        },
        {
            "statistic": "TOTAL_TIME",
            "value": 559.7992767999998
        },
        {
            "statistic": "MAX",
            "value": 2.3612968
        }
    ],
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The MAX metrics is a rolling max. So it represents the maximum measurement in a rolling window.

For example if you were to scrape your metrics every minute:

          Total    Count   Max
Minute 1    100        1   100  
Minute 2    500      101    90
Minute 3   4500     1000    10
Minute 4   4500     1000     0

In minute 1 you had 1 request, and a total of 100ms, so the average duration was 100ms, and the slowest (the max) was 100ms

In minute 2 total has increased by 400 (since total is cummulative) and count has increased by 100. So average is 4ms. However since the max is 90ms, then you know that while most of your requests in that second were fast, there were still some that were slower.

In minute 3 you had 899 more requests (count) and 4000ms added to the total. (4000/899 = ~4.4ms) So your average measurement was 4.4ms and the max was 10ms.

So the purpose of the MAX is to measure the worst outlier so you know how consistent the code is performing.

Looking at minute 4, the total and count haven't increased because there were no requests. Since there were no requests, then there couldn't be a 'slowest' request for the MAX, and that is why the MAX is 0.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...