1 parent 3b53fa4 commit eea1fc1Copy full SHA for eea1fc1
1 file changed
sentry_sdk/integrations/boto3/_instrumentation.py
@@ -193,7 +193,12 @@ def _instrument_streaming_body(
193
if isinstance(span, StreamedSpan):
194
streaming_span = sentry_sdk.traces.start_span(
195
name=span.name,
196
+ # `parent_span` is set explicitly to the boto span.
197
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.
202
active=False,
203
attributes={
204
"sentry.op": OP.HTTP_CLIENT_STREAM,
0 commit comments