Skip to content

Commit 6cdab16

Browse files
.
1 parent 4cf7e5a commit 6cdab16

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

sentry_sdk/integrations/anthropic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,13 @@ def _set_output_data(
392392
span.__exit__(None, None, None)
393393

394394

395-
def _set_streaming_output_data(
395+
def _patch_streaming_response_iterator(
396396
result: "AsyncStream[RawMessageStreamEvent]",
397397
span: "sentry_sdk.tracing.Span",
398398
):
399+
"""
400+
Responsible for closing the `gen_ai.chat` span and setting attributes acquired during response consumption.
401+
"""
399402
integration = sentry_sdk.get_client().get_integration(AnthropicIntegration)
400403

401404
old_iterator = result._iterator
@@ -510,7 +513,7 @@ def _sentry_patched_create_common(f: "Any", *args: "Any", **kwargs: "Any") -> "A
510513

511514
is_streaming_response = kwargs.get("stream", False)
512515
if is_streaming_response:
513-
_set_streaming_output_data(result, span)
516+
_patch_streaming_response_iterator(result, span)
514517
return result
515518

516519
with capture_internal_exceptions():

0 commit comments

Comments
 (0)