Skip to content

Commit fcf00db

Browse files
chore(litellm): Remove transaction-based tracing (#7379)
Remove branches for the static trace lifecycle. Remove manual tracing API calls in tests, as the outer transaction is no longer needed for GenAI spans in the streaming trace lifecycle. Closes #7100
1 parent 29ea004 commit fcf00db

2 files changed

Lines changed: 854 additions & 1996 deletions

File tree

‎sentry_sdk/integrations/litellm.py‎

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from sentry_sdk import consts
66
from sentry_sdk.ai.monitoring import record_token_usage
77
from sentry_sdk.ai.utils import (
8-
get_start_span_function,
98
set_data_normalized,
109
transform_openai_content_part,
1110
truncate_and_annotate_embedding_inputs,
@@ -101,29 +100,17 @@ def _input_callback(kwargs: "Dict[str, Any]") -> None:
101100
operation = "chat"
102101

103102
# Start a new span/transaction
104-
if has_span_streaming_enabled(client.options):
105-
span = sentry_sdk.traces.start_span(
106-
name=f"{operation} {model}",
107-
attributes={
108-
"sentry.op": (
109-
consts.OP.GEN_AI_CHAT
110-
if operation == "chat"
111-
else consts.OP.GEN_AI_EMBEDDINGS
112-
),
113-
"sentry.origin": LiteLLMIntegration.origin,
114-
},
115-
)
116-
else:
117-
span = get_start_span_function()(
118-
op=(
103+
span = sentry_sdk.traces.start_span(
104+
name=f"{operation} {model}",
105+
attributes={
106+
"sentry.op": (
119107
consts.OP.GEN_AI_CHAT
120108
if operation == "chat"
121109
else consts.OP.GEN_AI_EMBEDDINGS
122110
),
123-
name=f"{operation} {model}",
124-
origin=LiteLLMIntegration.origin,
125-
)
126-
span.__enter__()
111+
"sentry.origin": LiteLLMIntegration.origin,
112+
},
113+
)
127114

128115
_store_span(kwargs, span)
129116

0 commit comments

Comments
 (0)