Skip to content

Commit 9edfefb

Browse files
committed
[asgi] fix UnboundLocalError local variable 'start' referenced before assignment
see open-telemetry#1883
1 parent 318cd04 commit 9edfefb

File tree

1 file changed

+1
-1
lines changed
  • instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi

1 file changed

+1
-1
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ async def __call__(self, scope, receive, send):
538538
receive: An awaitable callable yielding dictionaries
539539
send: An awaitable callable taking a single dictionary as argument.
540540
"""
541+
start = default_timer()
541542
if scope["type"] not in ("http", "websocket"):
542543
return await self.app(scope, receive, send)
543544

@@ -591,7 +592,6 @@ async def __call__(self, scope, receive, send):
591592
send,
592593
duration_attrs,
593594
)
594-
start = default_timer()
595595

596596
await self.app(scope, otel_receive, otel_send)
597597
finally:

0 commit comments

Comments
 (0)