Skip to content

Conversation

alexander-alderman-webb
Copy link
Contributor

@alexander-alderman-webb alexander-alderman-webb commented Sep 2, 2025

The function _new_embeddings_create_common() creates a span context with the with keyword, whereas _new_responses_create_common() and _new_chat_completion_common() manually call __enter__ and set finish_span=True. Reusing the same _capture_exception() for all scenarios caused a double-exit in _wrap_async_embeddings_create(), which calls _new_embeddings_create_common().

Context:

Copy link

codecov bot commented Sep 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.88%. Comparing base (1d473b6) to head (2020cb6).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4736      +/-   ##
==========================================
+ Coverage   84.85%   84.88%   +0.03%     
==========================================
  Files         156      156              
  Lines       16115    16115              
  Branches     2741     2741              
==========================================
+ Hits        13674    13679       +5     
+ Misses       1651     1650       -1     
+ Partials      790      786       -4     
Files with missing lines Coverage Δ
sentry_sdk/integrations/openai.py 85.78% <100.00%> (+0.26%) ⬆️

... and 2 files with indirect coverage changes

@alexander-alderman-webb alexander-alderman-webb marked this pull request as ready for review September 2, 2025 11:23
@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner September 2, 2025 11:23
Copy link
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.

Thanks for fixing -- please also close #4723 once this is merged

@alexander-alderman-webb alexander-alderman-webb merged commit b1a8b63 into master Sep 2, 2025
145 of 147 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/avoid-double-exit branch September 2, 2025 12:14
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