fix(anthropic): Only finish relevant spans in .create() patches (#5716) · gitcommit90/sentry-python@45abbe3 · GitHub
Skip to content

Commit 45abbe3

Browse files
fix(anthropic): Only finish relevant spans in .create() patches (getsentry#5716)
Anthropic spans are only created in `_sentry_patched_create()` and `_sentry_patched_create_async()`. Exit spans in these functions when the anthropic library function raises an exception. Resolves an edge case where `_sentry_patched_create()` or `_sentry_patched_create_async()` exits early without creating a span, causing `get_current_span()` to return a non-anthropic span.
1 parent 9cb8aa4 commit 45abbe3

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

sentry_sdk/integrations/anthropic.py

Lines changed: 7 additions & 17 deletions

0 commit comments

Comments
 (0)