Repository navigation
fix(telemetry): don't drop log and metric batches on NaN or Infinity - #3249
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
JSON can't represent non-finite floats, so one of them in an attribute, parameter or metric value made the whole envelope fail to serialize. Send such attributes as strings and drop metrics with a non-finite value. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
PR risk: mediumFor commit Main concerns: data sent to Sentry, reach, host performance. This label is a hint for reviewers, not an approval. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A single
Float::NANorFloat::INFINITYin a log attribute or parameter, or in a metric attribute or value, makes the SDK lose every log or metric buffered with it.Cause: JSON has no representation for non-finite floats, so
JSON.generateraisesGeneratorErrorwhen the batch envelope item is serialized, and the whole batch fails.Fix:
"NaN","Infinity","-Infinity").inspectstring; before, the raw object was kept and failed later.valueis a non-finite float is dropped with a debug log message, since the value has to be a number.Tests: new specs in
metrics_spec.rbandlog_event_spec.rbfail without the change and pass with it. RuboCop passes on the touched files.This change was prepared with AI assistance.