Skip to content

feat(litellm): Support span streaming#6317

Open
alexander-alderman-webb wants to merge 3 commits into
masterfrom
webb/litellm/span-first
Open

feat(litellm): Support span streaming#6317
alexander-alderman-webb wants to merge 3 commits into
masterfrom
webb/litellm/span-first

Conversation

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor

@alexander-alderman-webb alexander-alderman-webb commented May 21, 2026

Description

Use sentry_sdk.traces.start_span and replace Span.set_data() with StreamedSpan.set_attribute() when in span streaming mode.

Parametrize tests on the trace lifecycle option.

Issues

Closes #6034

Reminders

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

Codecov Results 📊

2205 passed | ⏭️ 154 skipped | Total: 2359 | Pass Rate: 93.47% | Execution Time: 8m 34s

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 13488 uncovered lines.

Files with missing lines (1)
File Patch % Lines
sentry_sdk/integrations/litellm.py 0.00% ⚠️ 7 Missing

Generated by Codecov Action

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review May 21, 2026 11:47
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner May 21, 2026 11:47
@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft May 21, 2026 11:48
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 49ec553. Configure here.

Comment thread tests/integrations/litellm/test_litellm.py
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review May 28, 2026 09:06
Copy link
Copy Markdown
Member

@ericapisani ericapisani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions, but they're non-blocking

"sentry.op": (
consts.OP.GEN_AI_CHAT
if operation == "chat"
else consts.OP.GEN_AI_EMBEDDINGS
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this existed in the previous code, but this fallback seems like an interesting choice. I would've expected the inverse where chat is the fallback since I suspect it's the most common operation that would be performed with an AI provider 🤔

client.completions._client._client,
"send",
return_value=model_response,
), start_transaction(name="litellm test"):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double-checking that the start_transaction is intentional here, and that we wouldn't rather move to starting a segment when span_streaming is set to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate litellm to span first

2 participants