[AGENT-16861] Fix silent log loss on transient network errors - #92
Merged
ddrthall merged 1 commit intoAug 28, 2026
Merged
Conversation
Transient HTTP network failures (Net::ReadTimeout, EOFError, Errno::ECONNRESET, etc.) were not classified as retryable and were then swallowed by write's blanket rescue, so neither the plugin's own retry nor Fluentd core's buffer retry engaged and the in-flight batch was silently dropped. - Classify transient network exceptions raised by the HTTP client as RetryableError so send_retries handles them. - Re-raise from send_retries once bounded retries are exhausted instead of returning normally. - Log then re-raise in write (narrowed to StandardError) so Fluentd core's buffer retry/backoff engages. Adds unit tests covering all three paths. AGENT-16861
ddrthall
force-pushed
the
ryanhall/AGENT-16861-reraise-transient-write-errors
branch
from
August 27, 2026 14:40
fcbe7c4 to
52c9997
Compare
ddrthall
marked this pull request as ready for review
August 28, 2026 13:19
gh123man
approved these changes
Aug 28, 2026
ddrthall
deleted the
ryanhall/AGENT-16861-reraise-transient-write-errors
branch
August 28, 2026 18:39
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.
Summary
fluent-plugin-datadogsilently dropped in-flight log batches on transient network interruptions. Two gaps combined:Net::ReadTimeout,EOFError,Errno::ECONNRESET, etc.) raised by the persistent client were not classified asRetryableError, so the plugin's ownsend_retriesnever retried them. (Ruby'sNet::HTTPwon't retry a POST for us — POST is non-idempotent.)write(chunk)wrapped its body inrescue Exception => eand only logged, returning normally. Because a normal return signals success, Fluentd core committed and purged the chunk — its buffer retry never engaged.Net effect: on a transient blip, a batch of records was dropped with no retry from either the plugin or Fluentd core, and no operator-visible failure.
Changes
DatadogHTTPClient#send(mirrors the exception setNet::HTTPretries for idempotent requests, plusNet::HTTP::Persistent::Error), routing them through the existingsend_retriesbackoff loop.send_retriesonce bounded retries are exhausted, instead of returning normally and silently dropping the payload.write(narrowed fromExceptiontoStandardError, soSystemExit/Interruptare not trapped) so Fluentd core's buffer retry/backoff engages as designed.The two retry layers are complementary: plugin-level
send_retriesretries only the failing batch (avoiding duplicate re-sends of already-accepted batches within a multi-batch chunk), while Fluentd core provides durability, backpressure, and bounded retry lifetime as the backstop.Test plan
bundle exec rake test— 44 tests, 0 failuressendraisesRetryableErroronNet::ReadTimeout,EOFError,Errno::ECONNRESETsend_retriesre-raises after bounded exhaustion; does not retry non-retryable errorswritepropagates rather than swallows a client failureFixes AGENT-16861.