Skip to content

Commit 2f24e08

Browse files
committed
lint fixes
1 parent 6c65c4a commit 2f24e08

File tree

1 file changed

+12
-7
lines changed
  • instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi

1 file changed

+12
-7
lines changed

instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff 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":

0 commit comments

Comments
 (0)