Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding Spring Boot actuator `http.server.requests` metrics MAX attribute

can someone explain what does the MAX statistic refers to in the below response. I don't see it documented anywhere.

localhost:8081/actuator/metrics/http.server.requests?tag=uri:/myControllerMethod

Response:

{  
   "name":"http.server.requests",
   "description":null,
   "baseUnit":"milliseconds",
   "measurements":[  
      {  
         "statistic":"COUNT",
         "value":13
      },
      {  
         "statistic":"TOTAL_TIME",
         "value":57.430899
      },
      {  
         "statistic":"MAX",
         "value":0
      }
   ],
   "availableTags":[  
      {  
         "tag":"exception",
         "values":[  
            "None"
         ]
      },
      {  
         "tag":"method",
         "values":[  
            "GET"
         ]
      },
      {  
         "tag":"outcome",
         "values":[  
            "SUCCESS"
         ]
      },
      {  
         "tag":"status",
         "values":[  
            "200"
         ]
      },
      {  
         "tag":"commonTag",
         "values":[  
            "somePrefix"
         ]
      }
   ]
}
like image 203
Rahul Gupta Avatar asked Oct 16 '22 13:10

Rahul Gupta


1 Answers

You can see the individual metrics by using ?tag=url:{endpoint_tag} as defined in the response of the root /actuator/metrics/http.server.requests call. The details of the measurements values are;

  • COUNT: Rate per second for calls.
  • TOTAL_TIME: The sum of the times recorded. Reported in the monitoring system's base unit of time
  • MAX: The maximum amount recorded. When this represents a time, it is reported in the monitoring system's base unit of time.

As given here, also here.


The discrepancies you are seeing is due to the presence of a timer. Meaning after some time currently defined MAX value for any tagged metric can be reset back to 0. Can you add some new calls to /myControllerMethod then immediately do a call to /actuator/metrics/http.server.requests to see a non-zero MAX value for given tag?

This is due to the idea behind getting MAX metric for each smaller period. When you are seeing these metrics, you will be able to get an array of MAX values rather than a single value for a long period of time.

You can get to see this in action within Micrometer source code. There is a rotate() method focused on resetting the MAX value to create above described behaviour.

You can see this is called for every poll() call, which is triggered every some period for metric gathering.

like image 167
buræquete Avatar answered Dec 21 '22 15:12

buræquete