-
Notifications
You must be signed in to change notification settings - Fork 630
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(prometheus): Handle +Inf/-Inf from Prometheus #707
Conversation
igcherkaev
commented
Apr 17, 2020
- fix(prometheus): Prometheus can return "+Inf" and "-Inf" as values for metrics. This fixes java.lang.NumberFormatException in such cases.
Prometheus can return not only "NaN", but also "+Inf" and "-Inf" as values for metrics. Handle it properly and not crash if received such.
The following commits need their title changed:
Please format your commit title into the form:
This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here. |
Prometheus can return not only "NaN", but also "+Inf" and "-Inf" as values for metrics. Handle it properly and not crash if received such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'll leave it up to Justin to merge...
case "NaN": | ||
dataValues.add(Double.NaN); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like Double.valueOf
should handle this case already, although perhaps it's more clear to spell it out here anyway? It wants "Infinity" instead of "Inf", unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I thought about it, but decided to add it in case if they change it in Java in the future for any reason. It's like, you either track how NaN is spelled by Prometheus and at the same time ensure that Java parser expects the same, or you just map it explicitly to the constant of the Double class.
If Justin @fieldju finds it good, could you also cherry-pick it to the existing supported releases? |
@fieldju Justin, please, review? :) Thank you! |
Justin got back from paternity leave checking this out now. |
@igcherkaev, You can do that yourself with the bot: https://www.spinnaker.io/community/contributing/releasing/#cherry-pick-using-mergify |
Congratulations! And welcome back! :) |
@Mergifyio backport release-1.18.x |
@Mergifyio backport release-1.19.x |
@igcherkaev is not allowed to run commands |
@Mergifyio backport release-1.18.x |
@Mergifyio backport release-1.19.x |
* Handle +Inf/-Inf from prometheus Prometheus can return not only "NaN", but also "+Inf" and "-Inf" as values for metrics. Handle it properly and not crash if received such. * fix(prometheus): Handle +Inf/-Inf as values from prometheus Prometheus can return not only "NaN", but also "+Inf" and "-Inf" as values for metrics. Handle it properly and not crash if received such. Co-authored-by: Justin Field <justin.field@armory.io> (cherry picked from commit e8737fa)
Command
|
* Handle +Inf/-Inf from prometheus Prometheus can return not only "NaN", but also "+Inf" and "-Inf" as values for metrics. Handle it properly and not crash if received such. * fix(prometheus): Handle +Inf/-Inf as values from prometheus Prometheus can return not only "NaN", but also "+Inf" and "-Inf" as values for metrics. Handle it properly and not crash if received such. Co-authored-by: Justin Field <justin.field@armory.io> (cherry picked from commit e8737fa)
Command
|
WoOT WOoT! Way to go, bot! |