From e2b3ae7ff81b18fe1250a1d104ed41ca3d5cb897 Mon Sep 17 00:00:00 2001 From: Matt LeMay Date: Thu, 2 Jan 2025 08:53:19 -0500 Subject: [PATCH] fix: opentelemetry warning --- packages/http/httpx/kiota_http/httpx_request_adapter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/http/httpx/kiota_http/httpx_request_adapter.py b/packages/http/httpx/kiota_http/httpx_request_adapter.py index 93683227..d204ccc3 100644 --- a/packages/http/httpx/kiota_http/httpx_request_adapter.py +++ b/packages/http/httpx/kiota_http/httpx_request_adapter.py @@ -601,12 +601,14 @@ def get_request_from_request_information( otel_attributes = { HTTP_REQUEST_METHOD: method.value, - "http.port": url.port, SERVER_ADDRESS: url.hostname, URL_SCHEME: url.scheme, "url.uri_template": request_info.url_template, } + if url.port is not None: + otel_attributes["http.port"] = url.port + if self.observability_options.include_euii_attributes: otel_attributes.update({URL_FULL: url.geturl()})