-
Notifications
You must be signed in to change notification settings - Fork 890
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe your environment
Python 3.11.9, opentelemetry-instrumentation is auto-injected via the OpenTelemetry operator, opentelemetry_util_http is 0.44b0
Steps to reproduce
from opentelemetry.util.http import remove_url_credentials
literal_ipv6_url = "https://[::1]/somepath?query=foo"
remove_url_credentials(literal_ipv6_url)
# 'https://::1/somepath?query=foo' -- should be 'https://[::1]/somepath?query=foo'
literal_ipv6_url_with_port = "https://[::1]:12345/somepath?query=foo"
remove_url_credentials(literal_ipv6_url_with_port)
# 'https://::1:12345/somepath?query=foo -- should be 'https://[::1]:12345/somepath?query=foo'
literal_ipv6_url_with_auth = "https://someuser:somepass@[::1]:12345/somepath?query=foo"
remove_url_credentials(literal_ipv6_url_with_auth)
# 'https://::1:12345/somepath?query=foo' -- should be https://[::1]:12345/somepath?query=fooWhat is the expected behavior?
The ipv6 host should remain inside []
What is the actual behavior?
[] are stripped from the host
Additional context
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/util/opentelemetry-util-http/src/opentelemetry/util/http/__init__.py#L169 is the causing line. The hostname result on urlparse does not contain the brackets
from urllib.parse import urlparse
parsed = urlparse(literal_ipv6_url_with_auth)
parsed
# ParseResult(scheme='https', netloc='someuser:somepass@[::1]:12345', path='/somepath', params='', query='query=foo', fragment='')
parsed.hostname
# '::1'Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working