@@ -192,8 +192,8 @@ async def _run_app(self, scope, receive, send, asgi_version):
192192
193193 method = scope .get ("method" , "" ).upper ()
194194 transaction = None
195- if method in self . http_methods_to_capture :
196- if ty in ( "http" , " websocket") :
195+ if ty in ( "http" , "websocket" ) :
196+ if ty == " websocket" or method in self . http_methods_to_capture :
197197 transaction = continue_trace (
198198 _get_headers (scope ),
199199 op = "{}.server" .format (ty ),
@@ -205,17 +205,18 @@ async def _run_app(self, scope, receive, send, asgi_version):
205205 "[ASGI] Created transaction (continuing trace): %s" ,
206206 transaction ,
207207 )
208- else :
209- transaction = Transaction (
210- op = OP .HTTP_SERVER ,
211- name = transaction_name ,
212- source = transaction_source ,
213- origin = self .span_origin ,
214- )
215- logger .debug (
216- "[ASGI] Created transaction (new): %s" , transaction
217- )
208+ else :
209+ transaction = Transaction (
210+ op = OP .HTTP_SERVER ,
211+ name = transaction_name ,
212+ source = transaction_source ,
213+ origin = self .span_origin ,
214+ )
215+ logger .debug (
216+ "[ASGI] Created transaction (new): %s" , transaction
217+ )
218218
219+ if transaction :
219220 transaction .set_tag ("asgi.type" , ty )
220221 logger .debug (
221222 "[ASGI] Set transaction name and source on transaction: '%s' / '%s'" ,
0 commit comments