question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NaN gauge values not always filtered out

See original GitHub issue

#1116 intended to fix the issue of sending NaN values to Dynatrace, which is not valid JSON and results in a failure. In trying to use the DynatraceMeterRegistry, I get a failure like the following:

2019-03-29 16:08:14.272 ERROR 61557 --- [trics-publisher] i.m.dynatrace.DynatraceMeterRegistry     : failed to send metrics to dynatrace: {"error":{"code":400,"message":"Could not map JSON at 'series[22].dataPoints' near line 1 column 2524"}}

Debugging and looking at the request payload, I can see that NaN is trying to be sent in a dataPoint like:

{
    "timeseriesId": "custom:system.cpu.usage",
    "dataPoints": [
        [
            1553842062787,NaN
        ]
    ]
}

Looking at the code, it seems the issue is that some gauges can return a finite value one moment and NaN the next.

https://github.com/micrometer-metrics/micrometer/blob/6c657f93479b03835478153c33cde4122b7b7ac2/implementations/micrometer-registry-dynatrace/src/main/java/io/micrometer/dynatrace/DynatraceMeterRegistry.java#L148-L150

My theory is that on line 149 ms.getValue() is returning a finite number and on line 150 ms.getValue() is subsequently returning NaN.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
shakuzencommented, Mar 29, 2019

@izeye feel free to send a pull request. I’ve got plenty of other things to work on 😃

1reaction
shakuzencommented, Apr 3, 2019

I think it needs to be fixed regardless of it as there could be any custom meter having this behavior.

I agree. I mean that in addition to this we may want to look into the unexpected behavior more since it could affect other registries.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do reading Micrometer measurement returns NaN ...
This is due to Micrometer using 'weak references' in gauges. Since the gauge doesn't hold a strong reference to the object, when the...
Read more >
Micrometer Metrics - Quarkus
Gauges measure a value that can increase or decrease over time, like the speedometer on a car ... entirely or uses NaN (not...
Read more >
Micrometer Application Monitoring
Micrometer includes a SimpleMeterRegistry that holds the latest value of each meter in memory and does not export the data anywhere. If you...
Read more >
Filter out NaN values in column - Microsoft Power BI Community
Solved: Hi All, I have a column called "Value" in my PBI file, which is of Decimal Number type by default also containing...
Read more >
What's new in Grafana v9.0
Prometheus queries are not the easiest to write or understand. ... Starting with grafana 9.0.0, we will always keep NaN values unchanged for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found