From e2b3ae7ff81b18fe1250a1d104ed41ca3d5cb897 Mon Sep 17 00:00:00 2001 From: Matt LeMay Date: Thu, 2 Jan 2025 08:53:19 -0500 Subject: [PATCH 1/2] 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()}) From 6e7fba7e44a5fde97ff0b3b664a253d7e16ce4ca Mon Sep 17 00:00:00 2001 From: Matt LeMay Date: Thu, 2 Jan 2025 08:58:20 -0500 Subject: [PATCH 2/2] chore: address pr comments --- packages/http/httpx/kiota_http/httpx_request_adapter.py | 2 +- 1 file changed, 1 insertion(+), 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 d204ccc3..8adadea5 100644 --- a/packages/http/httpx/kiota_http/httpx_request_adapter.py +++ b/packages/http/httpx/kiota_http/httpx_request_adapter.py @@ -607,7 +607,7 @@ def get_request_from_request_information( } if url.port is not None: - otel_attributes["http.port"] = url.port + otel_attributes["http.port"] = str(url.port) if self.observability_options.include_euii_attributes: otel_attributes.update({URL_FULL: url.geturl()})