fix micrometer invalid double values#1419
Conversation
eyalkoren
left a comment
There was a problem hiding this comment.
Lots of other meters' APIs return double values, like timers totalTime() and even count(). Can these fail us as well?
Maybe this check should be moved to MicrometerMeterRegistrySerializer#serializeValue() that can return a boolean indicating if the value was added?
I have checked implementation of those (at least the version we compile against for the micrometer plugin), and they default to zero, thus I assume it is mostly safe to do so. End-user provided sub-classes aren't really expected here as the instances are provided through a builder from micrometer framework. |
|
OK, we will fix more if required then |
|
@eyalkoren @felixbarny Thank you. |
|
@SylvainJuge |
What does this PR do?
Micrometer plugin reports metrics through a dedicated JSON serialization code, and does not properly handle corner cases with gauges that can have values of
Double.NaNorDouble.NEGATIVE_INFINITY, as a result there are cases where metric sets are sent with strings as values instead of numbers, for example-Infinity.Ideally in the future if we start to have multiple plugins that report metrics, we should probably provide an internal API for this so there is no duplication of code and potential issues.
Checklist