Skip to content
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 for opentsdb output-plugin for NaN and Inf in float64 value #7908

Merged
merged 2 commits into from
Aug 6, 2020
Merged

Fix for opentsdb output-plugin for NaN and Inf in float64 value #7908

merged 2 commits into from
Aug 6, 2020

Conversation

Aladex
Copy link
Contributor

@Aladex Aladex commented Jul 28, 2020

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

When in prometheus metrics we have a value with NaN or Inf, Telegraf cannot to send metrics in TSDB and write the error in stdout:

2020-07-28T08:42:32Z E! [agent] Error writing to outputs.opentsdb: Metric serialization error json: unsupported value: NaN

I fixed this error like in json serializer: https://github.com/influxdata/telegraf/blob/master/plugins/serializers/json/json.go#L61

case int64:
case uint64:
case float64:
// JSON does not support these special values
if math.IsNaN(fv) || math.IsInf(fv, 0) {
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like elsewhere these are serialized as null. should we be doing that instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like elsewhere these are serialized as null. should we be doing that instead?

I do not think so. I dont found any of. So. Here we have a type checking, its logical to add checking of float64 for NaN or Inf. And we have errors for NaN from 1.14 version =)

@ssoroka ssoroka requested a review from reimda July 28, 2020 17:42
@ssoroka ssoroka merged commit 2e751d0 into influxdata:master Aug 6, 2020
@sjwang90 sjwang90 added this to the 1.15.3 milestone Sep 1, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
arstercz pushed a commit to arstercz/telegraf that referenced this pull request Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants