File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -698,14 +698,19 @@ async def otel_send(message: dict[str, Any]):
698698 self .client_response_hook (send_span , scope , message )
699699
700700 status_code = None
701- if message ["type" ] == "http.response.start" :
702- status_code = message ["status" ]
703- elif message ["type" ] == "websocket.send" :
704- status_code = 200
705- if status_code :
706- duration_attrs [SpanAttributes .HTTP_STATUS_CODE ] = (
707- status_code
701+ if message ["type" ] in {
702+ "http.response.start" ,
703+ "websocket.send" ,
704+ }:
705+ status_code = (
706+ message ["status" ]
707+ if message ["type" ] == "http.response.start"
708+ else 200
708709 )
710+ if status_code :
711+ duration_attrs [SpanAttributes .HTTP_STATUS_CODE ] = (
712+ status_code
713+ )
709714
710715 if send_span .is_recording ():
711716 if message ["type" ] == "http.response.start" :
You can’t perform that action at this time.
0 commit comments