Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ def __init__(
before_send_metric: "Optional[Callable[[Metric, Hint], Optional[Metric]]]" = None,
org_id: "Optional[str]" = None,
strict_trace_continuation: bool = False,
stream_gen_ai_spans: bool = False,
stream_gen_ai_spans: bool = True,
Comment thread
alexander-alderman-webb marked this conversation as resolved.
Comment thread
alexander-alderman-webb marked this conversation as resolved.
) -> None:
"""Initialize the Sentry SDK with the given parameters. All parameters described here can be used in a call to `sentry_sdk.init()`.

Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ def finish(

finished_spans = []
has_gen_ai_span = False
if client.options.get("stream_gen_ai_spans", False):
if client.options.get("stream_gen_ai_spans", True):
for span in self._span_recorder.spans:
if span.timestamp is None:
continue
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/tracing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def should_truncate_gen_ai_input(options: "Optional[dict[str, Any]]") -> bool:
return True

return not options.get(
"stream_gen_ai_spans", False
"stream_gen_ai_spans", True
) and not has_span_streaming_enabled(options)


Expand Down
6 changes: 6 additions & 0 deletions tests/integrations/anthropic/test_anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3817,6 +3817,7 @@ def test_anthropic_message_truncation(sentry_init, capture_events):
integrations=[AnthropicIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()

Expand Down Expand Up @@ -3869,6 +3870,7 @@ async def test_anthropic_message_truncation_async(sentry_init, capture_events):
integrations=[AnthropicIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()

Expand Down Expand Up @@ -5337,6 +5339,7 @@ def test_message_with_base64_image(sentry_init, capture_events):
integrations=[AnthropicIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()
client = Anthropic(api_key="z")
Expand Down Expand Up @@ -5531,6 +5534,7 @@ def test_message_with_base64_pdf(sentry_init, capture_events):
integrations=[AnthropicIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()
client = Anthropic(api_key="z")
Expand Down Expand Up @@ -5719,6 +5723,7 @@ def test_message_with_mixed_content(sentry_init, capture_events):
integrations=[AnthropicIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()
client = Anthropic(api_key="z")
Expand Down Expand Up @@ -5802,6 +5807,7 @@ def test_message_with_multiple_images_different_formats(sentry_init, capture_eve
integrations=[AnthropicIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()
client = Anthropic(api_key="z")
Expand Down
4 changes: 4 additions & 0 deletions tests/integrations/google_genai/test_google_genai.py
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,7 @@ def test_google_genai_message_truncation(
integrations=[GoogleGenAIIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()

Expand Down Expand Up @@ -2672,6 +2673,7 @@ def test_generate_content_with_function_response(
integrations=[GoogleGenAIIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()

Expand Down Expand Up @@ -2727,6 +2729,7 @@ def test_generate_content_with_mixed_string_and_content(
integrations=[GoogleGenAIIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()

Expand Down Expand Up @@ -2837,6 +2840,7 @@ def test_generate_content_with_list_of_dicts(
integrations=[GoogleGenAIIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()

Expand Down
1 change: 1 addition & 0 deletions tests/integrations/langchain/test_langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3018,6 +3018,7 @@ def test_langchain_message_truncation(sentry_init, capture_events):
integrations=[LangchainIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()

Expand Down
1 change: 1 addition & 0 deletions tests/integrations/langgraph/test_langgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,7 @@ def test_langgraph_message_truncation(sentry_init, capture_events):
integrations=[LanggraphIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()

Expand Down
1 change: 1 addition & 0 deletions tests/integrations/litellm/test_litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2539,6 +2539,7 @@ def test_litellm_message_truncation(sentry_init, capture_events):
disabled_integrations=[StdlibIntegration],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)
events = capture_events()

Expand Down
1 change: 1 addition & 0 deletions tests/integrations/openai/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -5658,6 +5658,7 @@ def test_openai_message_truncation(
integrations=[OpenAIIntegration(include_prompts=True)],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)

client = OpenAI(api_key="z")
Expand Down
1 change: 1 addition & 0 deletions tests/integrations/openai_agents/test_openai_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -4734,6 +4734,7 @@ def test_openai_agents_message_truncation(sentry_init, capture_items):
integrations=[OpenAIAgentsIntegration()],
traces_sample_rate=1.0,
send_default_pii=True,
stream_gen_ai_spans=False,
)

test_messages = [
Expand Down
Loading