diff --git a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py index 60c43f6db0..541c28d1ab 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py @@ -288,7 +288,9 @@ def client_response_hook(span: Span, scope: Scope, message: dict[str, Any]): redact_url, sanitize_method, ) - +from opentelemetry.semconv._incubating.attributes.http_attributes import ( + HTTP_SERVER_NAME, +) class ASGIGetter(Getter[dict]): def get( @@ -397,7 +399,7 @@ def collect_request_attributes( http_host_value_list = asgi_getter.get(scope, "host") if http_host_value_list: if _report_old(sem_conv_opt_in_mode): - result[SpanAttributes.HTTP_SERVER_NAME] = ",".join( + result[HTTP_SERVER_NAME] = ",".join( http_host_value_list ) http_user_agent = asgi_getter.get(scope, "user-agent")