fix(llmobs): emit a single error log when payload send retries are exhausted - #19691
fix(llmobs): emit a single error log when payload send retries are exhausted#19691shinsuke938 wants to merge 2 commits into
Conversation
Log connection failures at debug level while retries remain so errors only represent definitively dropped payloads. Co-authored-by: Cursor <cursoragent@cursor.com>
Explain that transient delivery failures no longer produce misleading error logs. Co-authored-by: Cursor <cursoragent@cursor.com>
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 2f12c38 | Docs | Datadog PR Page | Give us feedback! |
BenchmarksBenchmark execution time: 2026-08-14 06:27:32 Comparing candidate commit 2f12c38 in PR branch Found 0 performance improvements and 6 performance regressions! Performance is the same for 615 metrics, 9 unstable metrics. scenario:httppropagationinject-ids_only
scenario:iastaspectsospath-ospathbasename_aspect
scenario:iastaspectssplit-rsplit_aspect
scenario:span-start
scenario:telemetryaddmetric-1-count-metric-1-times
scenario:tracer-small
|
| logger.debug("sent %d LLMObs %s events to %s", num_events, self.EVENT_TYPE, self._url) | ||
| return Response.from_http_response(resp) | ||
| except Exception: | ||
| logger.error( |
There was a problem hiding this comment.
This ERROR log predates the retry path. It originated in a single-attempt writer
where the except block was inline in periodic() with no raise and no retry
wrapper (see 76b8817 and earlier), so an error-level log was the correct signal for
a definitively dropped payload.
When retry logic was added in v2.11.0, the log moved
into the retried _send_payload and a second error log appeared at the periodic()level.
The per-attempt error level was carried over, not chosen for the retry path.
Description
Fixes #17476.
LLMObs retries payload delivery up to three times after connection failures. Previously,
every failed attempt emitted an
ERRORlog with a traceback. If all attempts failed,periodic()emitted the sameERRORagain when the payload was finally dropped.As a result:
ERROR, even when a later retry succeeded.ERRORlog four times for one batch.This change logs individual connection failures at
DEBUGlevel and describes them asretry attempts. The exception is included using
%r, which preserves its type and messagewithout repeating the full traceback.
The existing
ERRORinperiodic()remains the final failure signal. It is emitted onlyafter all retry attempts fail and retains
exc_info=True, so one traceback is availablefor the dropped payload.
Retry behavior and dropped-payload telemetry are unchanged.
Testing
Added regression tests covering both connection-failure outcomes:
DEBUG, noERROR,and no dropped-payload telemetry.
DEBUGlogs, one finalERROR, and onedropped-payload telemetry record.
Risks
This intentionally reduces
ERRORvolume for connection failures. Monitors that rely oneach failed attempt being logged at
ERRORwill no longer observe transient failures;per-attempt details now require
DEBUGlogging.The final
failed to send ... LLMObs ... eventserror message is unchanged, so queriesmatching that message will continue to detect payloads dropped after retries are exhausted.
Additional Notes
HTTP error responses (
resp.status >= 300) retain their existingERRORlogging anddropped-payload telemetry behavior. This change only affects connection exceptions handled
by the retry path.