Skip to content

Commit eea1fc1

Browse files
committed
ref(boto3): Add specific comment on why we initialize with
1 parent 3b53fa4 commit eea1fc1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎sentry_sdk/integrations/boto3/_instrumentation.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ def _instrument_streaming_body(
193193
if isinstance(span, StreamedSpan):
194194
streaming_span = sentry_sdk.traces.start_span(
195195
name=span.name,
196+
# `parent_span` is set explicitly to the boto span.
196197
parent_span=span,
198+
# avoid making the streaming span the current span on the scope since the application might
199+
# keep `StreamingBody` open before reading it. Otherwise: 1. when the streamingspan ends it
200+
# could restore the parent span on the scope, breaking the parent-child relation of newly
201+
# created spans; 2. newly created spans would be attached to the streaming span.
197202
active=False,
198203
attributes={
199204
"sentry.op": OP.HTTP_CLIENT_STREAM,

0 commit comments

Comments
 (0)