fix(anthropic): Set exception info on streaming span when applicable by alexander-alderman-webb · Pull Request #5683 · getsentry/sentry-python · GitHub
Skip to content

fix(anthropic): Set exception info on streaming span when applicable#5683

Merged
alexander-alderman-webb merged 42 commits intomasterfrom
webb/anthropic/exc-on-exit
Mar 19, 2026
Merged

fix(anthropic): Set exception info on streaming span when applicable#5683
alexander-alderman-webb merged 42 commits intomasterfrom
webb/anthropic/exc-on-exit

Conversation

@alexander-alderman-webb
Copy link
Copy Markdown
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Mar 17, 2026

Description

Consolidate span finishing code in the __exit__ block of a new _StreamSpanContext context manager.
Forward exception info from _StreamSpanContext.__exit__() to Span.__exit__().

Issues

Reminders

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 17, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 17, 2026

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 17, 2026 12:38
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner March 17, 2026 12:38
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 17, 2026 15:15
Copy link
Copy Markdown
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

👍🏻

Base automatically changed from webb/anthropic/async-iterators to master March 18, 2026 13:53
Comment thread sentry_sdk/integrations/anthropic.py Outdated
@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft March 18, 2026 14:15
@alexander-alderman-webb alexander-alderman-webb changed the title fix(anthropic): Set exception info on span when applicable fix(anthropic): Set exception info on streaming span when applicable Mar 18, 2026
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 18, 2026 15:01
Comment thread sentry_sdk/integrations/anthropic.py
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 2 potential issues.

Fix All in Cursor

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

Comment thread sentry_sdk/integrations/anthropic.py
Comment thread sentry_sdk/integrations/anthropic.py
@alexander-alderman-webb alexander-alderman-webb marked this pull request as draft March 18, 2026 15:13
@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review March 18, 2026 15:59
Comment thread sentry_sdk/integrations/anthropic.py
Copy link
Copy Markdown
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

Looking great! Maybe add a comment on what _guaranteed_streaming_state means exactly?

@alexander-alderman-webb alexander-alderman-webb merged commit 8d56b30 into master Mar 19, 2026
158 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/anthropic/exc-on-exit branch March 19, 2026 10:24
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.

2 participants