1 parent 694474f commit 54c499eCopy full SHA for 54c499e
1 file changed
sentry_sdk/integrations/boto3/_instrumentation.py
@@ -195,7 +195,12 @@ def _instrument_streaming_body(
195
if isinstance(span, StreamedSpan):
196
streaming_span = sentry_sdk.traces.start_span(
197
name=span.name,
198
+ # `parent_span` is set explicitly to the boto span.
199
parent_span=span,
200
+ # avoid making the streaming span the current span on the scope since the application might
201
+ # keep `StreamingBody` open before reading it. Otherwise: 1. when the streamingspan ends it
202
+ # could restore the parent span on the scope, breaking the parent-child relation of newly
203
+ # created spans; 2. newly created spans would be attached to the streaming span.
204
active=False,
205
attributes={
206
"sentry.op": OP.HTTP_CLIENT_STREAM,
0 commit comments