Skip to content

fix micrometer invalid double values#1419

Merged
SylvainJuge merged 4 commits intoelastic:masterfrom
SylvainJuge:fix-micrometer-invalid-metrics
Sep 30, 2020
Merged

fix micrometer invalid double values#1419
SylvainJuge merged 4 commits intoelastic:masterfrom
SylvainJuge:fix-micrometer-invalid-metrics

Conversation

@SylvainJuge
Copy link
Member

@SylvainJuge SylvainJuge commented Sep 24, 2020

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.NaN or Double.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

  • This is a bugfix
@SylvainJuge SylvainJuge marked this pull request as ready for review September 24, 2020 13:45
@SylvainJuge SylvainJuge added the bug Bugs label Sep 24, 2020
@ghost
Copy link

ghost commented Sep 24, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Started by user sylvainjuge]

  • Start Time: 2020-09-29T18:49:12.242+0000

  • Duration: 46 min 37 sec

Test stats 🧪

Test Results
Failed 0
Passed 1563
Skipped 12
Total 1575

Copy link
Contributor

@eyalkoren eyalkoren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@eyalkoren eyalkoren mentioned this pull request Sep 29, 2020
@SylvainJuge
Copy link
Member Author

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.

@eyalkoren
Copy link
Contributor

OK, we will fix more if required then

@SylvainJuge SylvainJuge merged commit 883b656 into elastic:master Sep 30, 2020
@SylvainJuge SylvainJuge deleted the fix-micrometer-invalid-metrics branch September 30, 2020 07:44
@pkgonan
Copy link

pkgonan commented Oct 1, 2020

@eyalkoren @felixbarny
Hi, when do you expect release date this PR?
Perhaps 1.18.1 version.

Thank you.

@SylvainJuge
Copy link
Member Author

Hi @pkgonan !
The next release isn't scheduled yet, thus make sure that you have subscribed to notifications.

In the mean time, you can use the snapshot that is built every day from master if required.

@pkgonan
Copy link

pkgonan commented Oct 2, 2020

@SylvainJuge
Thank you for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bugs

4 participants