Spring Boot Actuator'http.server.requests'指标最大时间

Spring Boot Actuator'http.server.requests'指标最大时间

问题描述:

我有一个Spring Boot应用程序,并且我正在使用Spring Boot Actuator和Micrometer来跟踪有关我的应用程序的指标.我特别关注"http.server.requests"指标和MAX统计信息:

I have a Spring Boot application and I am using Spring Boot Actuator and Micrometer in order to track metrics about my application. I am specifically concerned about the 'http.server.requests' metric and the MAX statistic:

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

            ]
        }
    ]
}

我认为MAX统计量是执行一个请求的最长时间(因为我已经发出了两个请求,所以这是对其中一个请求进行较长时间处理的时间).

I suppose the MAX statistic is the maximum time of execution of a request (since I have made two requests, it's the the time of the longer processing of one of them).

每当我通过任何标签(例如localhost:9090/actuator/metrics?tag=status:200

Whenever I filter the metric by any tag, like localhost:9090/actuator/metrics?tag=status:200

{
        "name": "http.server.requests",
        "measurements": [
            {
                "statistic": "COUNT",
                "value": 1
            },
            {
                "statistic": "TOTAL_TIME",
                "value": 0.029653001
            },
            {
                "statistic": "MAX",
                "value": 0.0
            }
        ],
        "availableTags": [
            {
                "tag": "exception",
                "values": [
                    "None"
                ]
            },
            {
                "tag": "method",
                "values": [
                    "GET"
                ]
            }
        ]
    }

我总是得到0.0作为最大时间.这是什么原因呢?

I am always getting 0.0 as a max time. What is the reason of this?

  • MAX代表什么 ( MAX讨论)
  • MAX表示执行端点所需的最长时间.

    MAX represents the maximum time taken to execute endpoint.

    /user/asset/getAllAssets

COUNT  TOTAL_TIME  MAX
5      115         17
6      122         17  (Execution Time = 122 - 115 = 17)
7      131         17  (Execution Time = 131 - 122 = 17)
8      187         56  (Execution Time = 187 - 131 = 56)  
9      204         56  From Now MAX will be 56 (Execution Time = 204 - 187 = 17)  


  • 如果对特定端点的请求数(或1个请求)减少,MAX会为0吗?

    • Will MAX be 0 if we have less number of request (or 1 request) to the particular endpoint?
    • 对特定端点的请求数量不影响MAX (请参阅Spring Boot Admin中的图像)

      No number of request for particular endPoint does not affect the MAX (see an image from Spring Boot Admin)

      • 当MAX为0时

      DistributionStatisticConfig has .expiry(Duration.ofMinutes(2)) which sets the some measutement to 0 if there is no request has been made for last 2 minutes (120 seconds)

      诸如public TimeWindowMax(Clock clock,...)private void rotate() 此处

      • 我如何确定计时器值?

      为此,我采取了6个样本(对同一端点执行了6次).为此,我确定了调用端点的时间-MAX设置为零的时间之间的时间差

      For that, I have taken 6 samples (executed the same endpoint for 6 times). For that, I have determined the time difference between the time of calling the endpoint - time for when MAX set back to zero

      MAX 属性属于 测量 (在测量中,我们获得COUNT,TOTAL_TIME,MAX)

      公共静态最终统计信息 MAX

      记录的最大数量.当这代表一个时间时,它是 报告监视系统的基本时间单位.

      The maximum amount recorded. When this represents a time, it is reported in the monitoring system's base unit of time.


      注释: 这是来自特定端点(此处为/actuator/metrics/http.server.requests?tag=uri:/user/asset/getAllAssets)的度量标准的情况.


      Notes: This is the cases from metric for a particular endpoint (here /actuator/metrics/http.server.requests?tag=uri:/user/asset/getAllAssets).

      用于actuator/metrics/http.server.requests的通用度量

      MAX将设置为0.在我看来,/http.server.requests的MAX将与特定端点相同.

      MAX for some endPoint will be set backed to 0 due to a timer. In my view for MAX for /http.server.requests will be same as a particular endpoint.

      更新

      文档已针对MAX进行了更新.

      The document has been updated for the MAX.

      注意:基本的DistributionSummary实现的最大值,例如 CumulativeDistributionSummaryStepDistributionSummary是时间 最大窗口(TimeWindowMax).这意味着它的值是最大值 时间窗口内的值.如果时间窗口结束,它将重置为 0,新的时间窗口再次开始.时间窗口大小将是 计价器注册表的步长,除非到期 DistributionStatisticConfig明确设置为其他值.

      NOTE: Max for basic DistributionSummary implementations such as CumulativeDistributionSummary, StepDistributionSummary is a time window max (TimeWindowMax). It means that its value is the maximum value during a time window. If the time window ends, it'll be reset to 0 and a new time window starts again. Time window size will be the step size of the meter registry unless expiry in DistributionStatisticConfig is set to other value explicitly.