Skip to content

Commit dd3063b

Browse files
call _end_invoke_agent_span instead of manually closing span
1 parent 557fc90 commit dd3063b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sentry_sdk/integrations/openai_agents/patches/agent_run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ async def patched_run_single_turn(cls, *args, **kwargs):
8888
except Exception as exc:
8989
if span is not None and span.timestamp is None:
9090
_record_exception_on_span(span, exc)
91-
span.__exit__(None, None, None)
92-
delattr(context_wrapper, "_sentry_agent_span")
91+
_end_invoke_agent_span(context_wrapper, agent)
9392

9493
_capture_exception(exc)
9594
raise exc from None

0 commit comments

Comments
 (0)