Skip to content

ref: Make stream_gen_ai_spans opt out#6658

Open
alexander-alderman-webb wants to merge 6 commits into
masterfrom
webb/stream_gen_ai_spans
Open

ref: Make stream_gen_ai_spans opt out#6658
alexander-alderman-webb wants to merge 6 commits into
masterfrom
webb/stream_gen_ai_spans

google-genai tests

a629fe2
Select commit
Loading
Failed to load commit list.
@sentry/warden / warden: find-bugs completed Jun 25, 2026 in 0s

1 issue

find-bugs: Found 1 issue (1 medium)

Medium

Blob content (e.g. base64 images) no longer redacted from gen_ai spans when stream_gen_ai_spans defaults to True - `sentry_sdk/consts.py:1331`

This branch makes stream_gen_ai_spans opt-out (default True) via should_truncate_gen_ai_input in tracing_utils.py. With the new default, should_truncate_gen_ai_input returns False, so integrations use the raw normalized messages instead of routing them through truncate_and_annotate_messages. Because redact_blob_message_parts is only invoked inside truncate_and_annotate_messages/truncate_and_annotate_embedding_inputs, the unconditional blob redaction (replacing base64 image/blob content with [Filtered]) is now bypassed on the default code path. There is no equivalent redaction in the streaming (traces.py) path, so multi-modal prompt blobs are sent unredacted to Sentry whenever prompt capture is enabled (send_default_pii=True and include_prompts=True). This redaction was previously unconditional (applied even with PII enabled), so coupling it to the now-disabled truncation appears to be an unintended side effect.


⏱ 2m 14s · 464.9k in / 19.7k out · $0.78

Annotations

Check warning on line 1331 in sentry_sdk/consts.py

See this annotation in the file changed.

@sentry-warden sentry-warden / warden: find-bugs

Blob content (e.g. base64 images) no longer redacted from gen_ai spans when stream_gen_ai_spans defaults to True

This branch makes `stream_gen_ai_spans` opt-out (default `True`) via `should_truncate_gen_ai_input` in `tracing_utils.py`. With the new default, `should_truncate_gen_ai_input` returns `False`, so integrations use the raw normalized messages instead of routing them through `truncate_and_annotate_messages`. Because `redact_blob_message_parts` is only invoked inside `truncate_and_annotate_messages`/`truncate_and_annotate_embedding_inputs`, the unconditional blob redaction (replacing base64 image/blob content with `[Filtered]`) is now bypassed on the default code path. There is no equivalent redaction in the streaming (`traces.py`) path, so multi-modal prompt blobs are sent unredacted to Sentry whenever prompt capture is enabled (`send_default_pii=True` and `include_prompts=True`). This redaction was previously unconditional (applied even with PII enabled), so coupling it to the now-disabled truncation appears to be an unintended side effect.