@@ -83,9 +83,10 @@ async def hello():
8383
8484 from opentelemetry.trace import Span
8585 from typing import Any
86+ from asgiref.typing import Scope, ASGIReceiveEvent, ASGISendEvent
8687 from opentelemetry.instrumentation.asgi import OpenTelemetryMiddleware
8788
88- async def application(scope: dict[str, Any], receive: Any , send: Any ):
89+ async def application(scope: Scope, receive: ASGIReceiveEvent , send: ASGISendEvent ):
8990 await send({
9091 'type': 'http.response.start',
9192 'status': 200,
@@ -99,15 +100,15 @@ async def application(scope: dict[str, Any], receive: Any, send: Any):
99100 'body': b'Hello, world!',
100101 })
101102
102- def server_request_hook(span: Span, scope: dict[str, Any] ):
103+ def server_request_hook(span: Span, scope: Scope ):
103104 if span and span.is_recording():
104105 span.set_attribute("custom_user_attribute_from_request_hook", "some-value")
105106
106- def client_request_hook(span: Span, scope: dict[str, Any] , message: dict[str, Any]):
107+ def client_request_hook(span: Span, scope: Scope , message: dict[str, Any]):
107108 if span and span.is_recording():
108109 span.set_attribute("custom_user_attribute_from_client_request_hook", "some-value")
109110
110- def client_response_hook(span: Span, scope: dict[str, Any] , message: dict[str, Any]):
111+ def client_response_hook(span: Span, scope: Scope , message: dict[str, Any]):
111112 if span and span.is_recording():
112113 span.set_attribute("custom_user_attribute_from_response_hook", "some-value")
113114
0 commit comments