Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit discrepancy between Timer and FunctionTimer in LoggingMeterRegistry #5816

Closed
jonatan-ivanov opened this issue Jan 21, 2025 · 0 comments
Labels
bug A general bug module: micrometer-core An issue that is related to our core module
Milestone

Comments

@jonatan-ivanov
Copy link
Member

Found by @fstaudt, see: #5590 (comment)

While writing unit tests for LoggingMeterRegistry, I noticed a discrepancy between logs for Timer and FunctionTimer.
For Timer, I had: " throughput=" + print.unitlessRate(count) + ....
For FunctionTimer, I had " throughput=" + print.rate(count) + ....

As a result, The logs for those 2 meters were:

my.timer{} delta_count=30 throughput=0.5/s mean=1s max=1s
my.function-timer{} delta_count=30 throughput=0.5 milliseconds/s mean=1s

The logs for function-timer were IMO incorrect; the throughput for this meter provides the number of measurements by seconds and does not depend on the base unit of the meter.
Therefore, I used unitlessRate for throughput to align the logging of those 2 meters and get similar logs for both:

my.timer{} delta_count=30 throughput=0.5/s mean=1s max=1s
my.function-timer{} delta_count=30 throughput=0.5/s mean=1s

The fix is also here: #5590 (comment)

@jonatan-ivanov jonatan-ivanov added the bug A general bug label Jan 21, 2025
@jonatan-ivanov jonatan-ivanov added this to the 1.13.11 milestone Jan 21, 2025
@jonatan-ivanov jonatan-ivanov added the module: micrometer-core An issue that is related to our core module label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug module: micrometer-core An issue that is related to our core module
Projects
None yet
Development

No branches or pull requests

1 participant