File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments