Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from sentry_sdk.traces import StreamedSpan
from sentry_sdk.tracing_utils import (
has_span_streaming_enabled,
should_truncate_gen_ai_input,
)
from sentry_sdk.utils import has_data_collection_enabled, safe_serialize

Expand Down Expand Up @@ -92,7 +91,7 @@ def invoke_agent_span(
scope = sentry_sdk.get_current_scope()
messages_data = (
truncate_and_annotate_messages(normalized_messages, span, scope)
if should_truncate_gen_ai_input(client.options)
Comment thread
alexander-alderman-webb marked this conversation as resolved.
if not has_span_streaming_enabled(client.options)
else normalized_messages
)
if messages_data is not None:
Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/integrations/openai_agents/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sentry_sdk.integrations import DidNotEnable
from sentry_sdk.scope import should_send_default_pii
from sentry_sdk.traces import StreamedSpan
from sentry_sdk.tracing_utils import should_truncate_gen_ai_input
from sentry_sdk.tracing_utils import has_span_streaming_enabled
from sentry_sdk.utils import (
event_from_exception,
has_data_collection_enabled,
Expand Down Expand Up @@ -193,7 +193,7 @@ def _set_input_data(
scope = sentry_sdk.get_current_scope()
messages_data = (
truncate_and_annotate_messages(normalized_messages, span, scope)
if should_truncate_gen_ai_input(client.options)
if not has_span_streaming_enabled(client.options)
else normalized_messages
)
if messages_data is not None:
Expand Down
9 changes: 0 additions & 9 deletions sentry_sdk/tracing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,6 @@ def has_span_streaming_enabled(options: "Optional[dict[str, Any]]") -> bool:
return is_enabled_in_experiment_config


def should_truncate_gen_ai_input(options: "Optional[dict[str, Any]]") -> bool:
if options is None:
return True

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


@contextlib.contextmanager
def record_sql_queries(
cursor: "Any",
Expand Down
Loading
Loading