File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -253,7 +253,10 @@ async def user_profile(user_id):
253253from asgiref .compatibility import guarantee_single_callable
254254
255255from opentelemetry import context , trace
256- from opentelemetry .instrumentation ._labeler import enhance_metric_attributes
256+ from opentelemetry .instrumentation ._labeler import (
257+ enhance_metric_attributes ,
258+ get_labeler ,
259+ )
257260from opentelemetry .instrumentation ._semconv import (
258261 HTTP_DURATION_HISTOGRAM_BUCKETS_NEW ,
259262 _filter_semconv_active_request_count_attr ,
@@ -735,6 +738,9 @@ async def __call__(
735738 receive: An awaitable callable yielding dictionaries
736739 send: An awaitable callable taking a single dictionary as argument.
737740 """
741+ # Required to create new instance for custom attributes in async context
742+ _ = get_labeler ()
743+
738744 start = default_timer ()
739745 if scope ["type" ] not in ("http" , "websocket" ):
740746 return await self .app (scope , receive , send )
You can’t perform that action at this time.
0 commit comments