Skip to content

fix(openai): Only finish relevant spans in Responses patches - #6191

Merged
alexander-alderman-webb merged 9 commits into
masterfrom
webb/openai/remove-get-current-span-responses
May 5, 2026
Merged

alexander-alderman-webb merged 9 commits into
masterfrom
webb/openai/remove-get-current-span-responses

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented May 4, 2026 •

Copy link
Copy Markdown
Collaborator

Description

OpenAI Responses spans are only created in _new_sync_responses_create() and _new_async_responses_create().

Exit spans in these functions when the openai library function raises an exception.

Resolves an edge case where _new_sync_responses_create() or _new_async_responses_create() exits early and does not create a span and get_current_span() therefore returns a non-openai span.

Issues

Reminders

@alexander-alderman-webb alexander-alderman-webb changed the title Only finish relevant spans in Responses patches fix(openai): Only finish relevant spans in Responses patches May 4, 2026
@github-actions

github-actions Bot commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

Codecov Results 📊

✅ 2187 passed | ⏭️ 154 skipped | Total: 2341 | Pass Rate: 93.42% | Execution Time: 5m 0s

All tests are passing successfully.

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

Files with missing lines (1)
File Patch % Lines
openai.py 4.23% ⚠️ 656 Missing

Generated by Codecov Action

@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review May 4, 2026 07:04
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner May 4, 2026 07:04
Base automatically changed from webb/openai/remove-get-current-span-completions to master May 5, 2026 14:45
@alexander-alderman-webb
alexander-alderman-webb merged commit b1d5b72 into master May 5, 2026
154 of 156 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/openai/remove-get-current-span-responses branch May 5, 2026 14:59
mgaligniana pushed a commit to mgaligniana/sentry-python that referenced this pull request Aug 9, 2026
…ry#6191)

OpenAI Responses spans are only created in `_new_sync_responses_create()` and `_new_async_responses_create()`.

Exit spans in these functions when the openai library function raises an exception.

Resolves an edge case where `_new_sync_responses_create()` or `_new_async_responses_create()` exits early without creating a span, causing `get_current_span()` to return a non-openai span.
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