-
Notifications
You must be signed in to change notification settings - Fork 984
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
TimeWindowMax
throws ArithmeticException
with a rotateFrequency of 0
#3068
Comments
I just ran into this one when someone set the step size for a registry to 0 as a way of "disabling" metrics reporting. Surprising error that came from SimpleMeterRegistry passing the step size forward through
Maybe a simple validation check somewhere along this flow would be warranted. |
I am closing this issue as the cause was an errendous mock of the PromotheusConfig in the test-environment. Validation could be considered to provide better feedback when the issue is presented. |
TimeWindowMax
throws ArithmeticException
with a rotateFrequency of 0
I'm reopening this to improve the validation. |
without this change you can get an arithmetic exception if you pass a 0. Negative numbers don't make sense fixes gh-3068
This PR should fix things |
Describe the bug
We are experiencing a bug caused by a modulus operation introduced in the
TimeWindowMax.java
class.java.lang.ArithmeticException: / by zero
is thrown when running our application tests.Environment
When running integration tests locally and as a part of gitlab build
To Reproduce
How to reproduce the bug:
I am not sure how to minimalistic reproduction of the bug. Our application was working fine on Micrometer version
1.6.4
. It fails when upgrading to version1.8.1
, see details below:The bug is caused by line 139 in the TimeWindowMax.java class.
This line will throw
java.lang.ArithmeticException: / by zero
whenever durationBetweenRoatesMillis is 0. I assume this is a bug that should be fixed.Expected behavior
I expect the calculation to work even though durationBetweenRotatesMillis is set to 0.
The text was updated successfully, but these errors were encountered: