Skip to content

Commit eb771d8

Browse files
committed
Suppress Sentry capture for OTLP exporter batch failures
The OTel SDK logs "Failed to export X batch" at ERROR after retries are exhausted, which Sentry's LoggingIntegration would otherwise turn into a noisy issue per app per incident. Records still flow to console/file — only the Sentry capture is suppressed.
1 parent e03c3bd commit eb771d8

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

plain-cloud/plain/cloud/config.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,29 @@ def ready(self) -> None:
6262
if not settings.CLOUD_EXPORT_ENABLED or not settings.CLOUD_EXPORT_TOKEN:
6363
return
6464

65+
# Don't capture per-batch OTLP export failures as Sentry events. The OTel
66+
# SDK's exporters log "Failed to export X batch" at ERROR after retries
67+
# are exhausted, which Sentry's LoggingIntegration would otherwise turn
68+
# into an issue per app per incident — noise the app owner can't act on
69+
# (network/edge timeouts, ingest backend hiccups). The records still
70+
# flow to console/file/etc. — only the Sentry capture is suppressed.
71+
# Mirrors Sentry SDK's own self-protection for `sentry_sdk.errors` and
72+
# `urllib3.connectionpool` in sentry_sdk/integrations/logging.py.
73+
try:
74+
import sentry_sdk.integrations.logging as _sentry_log # ty: ignore[unresolved-import]
75+
except ImportError:
76+
pass
77+
else:
78+
for name in (
79+
"opentelemetry.exporter.otlp.proto.http.trace_exporter",
80+
"opentelemetry.exporter.otlp.proto.http.metric_exporter",
81+
"opentelemetry.exporter.otlp.proto.http._log_exporter",
82+
"opentelemetry.sdk._shared_internal",
83+
"opentelemetry.sdk._logs._internal.export",
84+
"opentelemetry.sdk.metrics._internal.export",
85+
):
86+
_sentry_log.ignore_logger(name)
87+
6588
resource = Resource.create(
6689
{
6790
service_attributes.SERVICE_NAME: settings.NAME,

0 commit comments

Comments
 (0)