-
Notifications
You must be signed in to change notification settings - Fork 5.7k
fix(outputs.influxdb_v2): Handle serialization errors correctly #17949
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(outputs.influxdb_v2): Handle serialization errors correctly #17949
Conversation
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
lowjoel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM apart from some clarifications. I can't run this right now since I don't seem to be getting NaNs from my data source right now.
|
Getting to it. Thanks for the ping; will come back with results in a bit! |
|
@lowjoel any chance you test the binary and report back in the issue? |
I can test the binary but I don't have any NaNs that can trip the bug now - the source was sporadically causing the metric rejection because it was sporadically writing NaNs. I couldn't figure out how but it hasn't in a few weeks. |
|
Ok, as @senpro-ingwersenk gave a go and my unit-test reproduces the |
skartikey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srebhan The implementation is solid!
This correctly fixes the critical data loss bug where serialization errors would cause valid metrics to be dropped.
|
Oops, should've replied here instead of in #17235 Thank you for the PR! |
|
@IngwiePhoenix no worries, I always check both the issue and the PR, replying to both is fine... ;-) |
(cherry picked from commit e0fc4bf)
Summary
The current code fails to handle serialization errors, e.g. due to
NaNvalues or invalid field keys, as batching returns the serialization error straight away. Subsequently, the error triggers an early exit in the http client code because theusedvariable is zero.This PR fixes two issues:
Do not return early in the http client if one of the batches does not contain any payload. Instead check if the size of the limited serializer is exceeded and if not continue to process the remaining batches. This prevents early exits and thus prevent the plugin to get stuck on serialization errors.
Reject metrics causing serialization errors to prevent infinite resend-loops and remove rejected metrics from the list of metrics acceptable later. Removing the metrics (or rather the indices) is required to not double-account the metric.
Checklist
Related issues
resolves #17205
resolves #17235