Micrometer: http.server.requests : MAX property settled to 0

Created on 15 Sep 2019  路  6Comments  路  Source: micrometer-metrics/micrometer

I am using Spring Boot 2.1.4 and added actuators and configured Spring Boot Admin which works fine. I am using /metrics/http.server.requests to get the details about endpoints. From that, we get MAX property which indicates the max time taken by the endpoint to be execute. As discussed here here is set back to 0 after an interval of 2 minutes.

Question:
How can I prevent or change the time for MAX to be set back to 0?
Now, in metrics http.server.requests has been replaced by http.client.requests which does not show my requests in Spring Boot Admin, how can I use http.server.requests

stack-overflow

Most helpful comment

Thanks @izeye!

All 6 comments

That StackOverflow question is confusing and doesn't seems to answer the question, but rather has some guesses involved. I also checked and the docs don't document this very clearly (that I could find).

MAX is intended to show the outlier and worst case measurement in a timeframe. Some other metrics libraries would display a MAX that was the highest the system had ever seen (since the JVM had been started). However that become less useful if the JVM is running for days and weeks since you wouldn't know how close to the MAX the code is hitting.

So in MicroMeter the MAX is a rolling MAX by window. If it shows 1 sec, then that mean the slowest measurement in that minute took 1 sec. And if it displays 0 then it means it had no measurements in that minute.

Regarding your question of http.server.requests and http.client.requests are 2 separate metrics. Server requests are requests that have be received. Client requests are how many requests have been made by your code using RestTemplate.

Since this isn't an actionable issue, let's move this discussion to Stack Overflow. feel free to post the link to further questions here.

I also checked and the docs don't document this very clearly (that I could find).

@checketts Shall we open an issue to improve the docs?

@shakuzen I created https://github.com/micrometer-metrics/micrometer-docs/pull/101 to improve the docs based on @checketts's comment.

Thanks @izeye!

Thanks @izeye for updating the docs. We have to change .expiry(Duration.ofMinutes(2)) in DistributionStatisticConfig class explicitly for a custom time window. Is it right? Is there any other way to change that time window?

@romilptl It seems so. If you change the value, it'll also affect other distribution statistics like percentiles as you can see its Javadoc.

Was this page helpful?
0 / 5 - 0 ratings