Skip to content

fix(litellm): Avoid double span exits when streaming#5933

Draft
alexander-alderman-webb wants to merge 4 commits intomasterfrom
webb/litellm/close-spans
Draft

fix(litellm): Avoid double span exits when streaming#5933
alexander-alderman-webb wants to merge 4 commits intomasterfrom
webb/litellm/close-spans

Conversation

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Apr 1, 2026

Description

Only exit the span on the final invocation of _success_callback when litellm streams a response.

The litellm.success_callback callbacks are fired multiple times when streaming a response with litellm.

Avoid an unhandled SDK exception by using litellm like a user would in the relevant test.

Issues

Reminders

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (integrations) Instrument pyreqwest tracing by servusdei2018 in #5682

Bug Fixes 🐛

  • (litellm) Avoid double span exits when streaming by alexander-alderman-webb in #5933

Internal Changes 🔧

  • (opentelemetry) Ignore mypy error by alexander-alderman-webb in #5927
  • Update validate-pr workflow by stephanie-anderson in #5931

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Codecov Results 📊

13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 8.81s

All tests are passing successfully.

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

Files with missing lines (1)
File Patch % Lines
litellm.py 0.00% ⚠️ 140 Missing

Generated by Codecov Action

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review April 1, 2026 13:56
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner April 1, 2026 13:56
@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft April 1, 2026 14:01
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review April 1, 2026 14:10
@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft April 1, 2026 14:20
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.

1 participant