opentelemetry-python-contrib
opentelemetry-python-contrib copied to clipboard
ASGI instrumentation metrics don't align with the semantic conventions
Describe your environment
OS: (Linux, MacOS) Python version: (Python 3.8) Package version: (0.50b0, 0.51b0)
What happened?
the _set_http_net_host method is implemented in _semconv.py to align with Semantic Conventions (v1.30.0), enabling the extraction of server.address in opt_in mode (see semconv doc) for the http.server.request.duration metric. However, this method is never imported in the ASGI instrumentation package (see instrumentation/asgi/init.py), making the server.address attribute unavailable.
Please fix this issue or provide a workaround to extract the http server name when using http.server.request.duration metric for ASGI instrumentation.
Steps to Reproduce
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/139f3e52d9a69fa2fc1de7aa89859d404b8baeb2/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/init.py#L219
the _set_http_net_host could be added here
Expected Result
server.address is enabled for http.server.request.duration
Actual Result
server.address doesn't work even in opt-in mode
Additional context
No response
Would you like to implement a fix?
None