fix(logs): store failed log events on intake errors#1131
Merged
Conversation
ndakkoune
approved these changes
May 22, 2026
klivan
pushed a commit
that referenced
this pull request
May 26, 2026
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.
What does this PR do?
Fixes the
DD_STORE_FAILED_EVENTSfeature for log events so failed log batches are actually stored in S3 and retried on subsequent invocations.In
DatadogHTTPClient.send(), the future returned byFuturesSession.post()was not awaited and the response status was never checked. Failures (network errors, HTTP 4xx/5xx) were either resolved later in_close()and silently swallowed, or never surfaced at all. As a result,forwarder._forward_logs()never saw an exception,failed_logsstayed empty, and nothing was written to the S3 retry prefix.This PR:
send()so failures are attributed to the current batch.response.raise_for_status()so HTTP 4xx/5xx propagate._futureslist and the swallow-all loop in_close().Forwarder._forward_logs.Motivation
Fixes #1129. Users relying on
DD_STORE_FAILED_EVENTS=trueto recover from transient Datadog intake errors were silently losing logs.Testing Guidelines
PYTHONPATH=. python3 aws/logs_monitoring/tests/test_datadog_http_client.py(4 tests pass).DD_STORE_FAILED_EVENTS=trueand pointDD_URLat an unresolvable host.s3://<bucket>/failed_events/<function-sha1>/logs/.DD_URL, invoke with{"retry": true}— stored batches are resent and the S3 objects are deleted.Additional Notes
Behavior changes worth noting for reviewers:
send()is now synchronous per batch. Previously batches were submitted concurrently viaFuturesSession, but errors were swallowed in_close(). Concurrency can be reintroduced in a follow-up if needed; the immediate priority is correctness.DD_STORE_FAILED_EVENTSS3 retry path rather than the in-process retry loop inDatadogClient, which was effectively unreachable for HTTP errors before this fix.Types of changes
Check all that apply