I need to determine how many times my GET /users endpoint is called during the last hour. My first thought was to use a counter and increment it everytime there is a call and rest every 3600 seconds.
Then I found that spring actuator can help provide this if filter using the URI :
localhost:8080/actuator/metrics/http.server.requests?tag=uri:/users
Response:
{
"name": "http.server.requests",
"description": null,
"baseUnit": "seconds",
"measurements": [
{
"statistic": "COUNT",
"value": 3
},
{
"statistic": "TOTAL_TIME",
"value": 0.21817219999999998
}
}
Here I called /users 3 times.
My question is, how do I retrieve those values in my code? Can anyone point me to an example? Thanks