@@ -159,7 +159,7 @@ async def __call__(self, scope, receive, send):
159159 span_name = self .name_callback (scope )
160160
161161 with self .tracer .start_as_current_span (
162- span_name + " (connection)" ,
162+ span_name + " (asgi. connection)" ,
163163 parent_span ,
164164 kind = trace .SpanKind .SERVER ,
165165 attributes = collect_request_attributes (scope ),
@@ -168,25 +168,21 @@ async def __call__(self, scope, receive, send):
168168 @wraps (receive )
169169 async def wrapped_receive ():
170170 with self .tracer .start_as_current_span (
171- span_name + " (unknown- receive)"
171+ span_name + " (asgi." + scope [ "type" ] + ". receive)"
172172 ) as receive_span :
173173 payload = await receive ()
174174 if payload ["type" ] == "websocket.receive" :
175175 set_status_code (receive_span , 200 )
176176 receive_span .set_attribute (
177177 "http.status_text" , payload ["text" ]
178178 )
179-
180- receive_span .update_name (
181- span_name + " (" + payload ["type" ] + ")"
182- )
183179 receive_span .set_attribute ("type" , payload ["type" ])
184180 return payload
185181
186182 @wraps (send )
187183 async def wrapped_send (payload ):
188184 with self .tracer .start_as_current_span (
189- span_name + " (" + payload ["type" ] + ")"
185+ span_name + " (asgi. " + scope ["type" ] + ".send )"
190186 ) as send_span :
191187 if payload ["type" ] == "http.response.start" :
192188 status_code = payload ["status" ]
@@ -196,7 +192,6 @@ async def wrapped_send(payload):
196192 send_span .set_attribute (
197193 "http.status_text" , payload ["text" ]
198194 )
199-
200195 send_span .set_attribute ("type" , payload ["type" ])
201196 await send (payload )
202197
0 commit comments