Skip to content

Commit be8edef

Browse files
committed
fix: ensure url_disabled checks handle URLs as strings
1 parent 502d381 commit be8edef

File tree

1 file changed

+7
-6
lines changed
  • instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx

1 file changed

+7
-6
lines changed

instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,12 @@ async def async_response_hook(span, request, response):
233233
from opentelemetry.trace import SpanKind, Tracer, TracerProvider, get_tracer
234234
from opentelemetry.trace.span import Span
235235
from opentelemetry.trace.status import StatusCode
236-
from opentelemetry.util.http import remove_url_credentials, sanitize_method
237-
from opentelemetry.utils.http import (
236+
from opentelemetry.util.http import (
238237
ExcludeList,
239238
get_excluded_urls,
240239
parse_excluded_urls,
240+
remove_url_credentials,
241+
sanitize_method,
241242
)
242243

243244
_excluded_urls_from_env = get_excluded_urls("HTTPX")
@@ -473,7 +474,7 @@ def handle_request(
473474
args, kwargs
474475
)
475476

476-
if self._excluded_urls and self._excluded_urls.url_disabled(url):
477+
if self._excluded_urls and self._excluded_urls.url_disabled(str(url)):
477478
return self._transport.handle_request(*args, **kwargs)
478479

479480
method_original = method.decode()
@@ -603,7 +604,7 @@ async def handle_async_request(
603604
args, kwargs
604605
)
605606

606-
if self._excluded_urls and self._excluded_urls.url_disabled(url):
607+
if self._excluded_urls and self._excluded_urls.url_disabled(str(url)):
607608
return await self._transport.handle_async_request(*args, **kwargs)
608609

609610
method_original = method.decode()
@@ -778,7 +779,7 @@ def _handle_request_wrapper( # pylint: disable=too-many-locals
778779
args, kwargs
779780
)
780781

781-
if excluded_urls and excluded_urls.url_disabled(url):
782+
if excluded_urls and excluded_urls.url_disabled(str(url)):
782783
return wrapped(*args, **kwargs)
783784

784785
method_original = method.decode()
@@ -857,7 +858,7 @@ async def _handle_async_request_wrapper( # pylint: disable=too-many-locals
857858
args, kwargs
858859
)
859860

860-
if excluded_urls and excluded_urls.url_disabled(url):
861+
if excluded_urls and excluded_urls.url_disabled(str(url)):
861862
return await wrapped(*args, **kwargs)
862863

863864
method_original = method.decode()

0 commit comments

Comments
 (0)