Skip to content

Commit 200fb99

Browse files
committed
.
1 parent 49e7824 commit 200fb99

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

sentry_sdk/integrations/asgi.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,20 +223,29 @@ async def _run_app(
223223
"sentry.origin": self.span_origin,
224224
"asgi.type": ty,
225225
}
226-
sentry_scope.set_custom_sampling_context({"asgi_scope": scope})
227226

228227
if ty in ("http", "websocket"):
229228
if (
230229
ty == "websocket"
231230
or method in self.http_methods_to_capture
232231
):
233232
sentry_sdk.traces.continue_trace(_get_headers(scope))
233+
234+
sentry_scope.set_custom_sampling_context(
235+
{"asgi_scope": scope}
236+
)
237+
234238
attributes["sentry.op"] = f"{ty}.server"
235239
segment = sentry_sdk.traces.start_span(
236240
name=transaction_name, attributes=attributes
237241
)
238242
else:
239243
sentry_sdk.traces.new_trace()
244+
245+
sentry_scope.set_custom_sampling_context(
246+
{"asgi_scope": scope}
247+
)
248+
240249
attributes["sentry.op"] = OP.HTTP_SERVER
241250
segment = sentry_sdk.traces.start_span(
242251
name=transaction_name, attributes=attributes

0 commit comments

Comments
 (0)