Skip to content

Commit 8aeea86

Browse files
.
1 parent 4b40b3a commit 8aeea86

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

sentry_sdk/integrations/anthropic.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -844,28 +844,9 @@ def _wrap_async_close(
844844
"""
845845

846846
async def close(self: "AsyncStream") -> None:
847-
if not hasattr(self, "_span"):
848-
return await f(self)
849-
850-
if not hasattr(self, "_model"):
851-
self._span.__exit__(None, None, None)
852-
del self._span
847+
with _StreamSpanContext(self):
853848
return await f(self)
854849

855-
_set_streaming_output_data(
856-
span=self._span,
857-
integration=self._integration,
858-
model=self._model,
859-
usage=self._usage,
860-
content_blocks=self._content_blocks,
861-
response_id=self._response_id,
862-
finish_reason=self._finish_reason,
863-
)
864-
self._span.__exit__(None, None, None)
865-
del self._span
866-
867-
return await f(self)
868-
869850
return close
870851

871852

0 commit comments

Comments
 (0)