micrometer-metrics / micrometer

An application observability facade for the most popular observability tools. Think SLF4J, but for observability.
https://micrometer.io
Apache License 2.0
4.39k stars 965 forks source link

Fix percentile metrics rotating too often #5237

Open rafalh opened 4 days ago

rafalh commented 4 days ago

Before this change percentile metrics rotation interval was set to expiry / bufferLength. This was different from other metrics like _max where the interval is set to expiry. At the same time documentation of the expiry parameter says clearly that it is used as rotation interval.

This inconsistent behavior was confusing for users because some metrics expired faster than the others. What's more it caused some requests to be ignored in percentile metrics if expiry (also called step) was set to the same duration as scrapping interval (e.g. 1 minute) and scrapping occurred not long after buffer rotation. In case of the default config where bufferLength is 3 it could result in up to 33% requests being ignored by percentile metrics.

Fix this inconsistency by changing buffer rotation interval for percentiles to expiry.

Fixes #3298

pivotal-cla commented 4 days ago

@rafalh Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla commented 4 days ago

@rafalh Thank you for signing the Contributor License Agreement!