opentelemetry-util-http: don't raise on unparsable request targets - #4965
Open
henry3260 wants to merge 1 commit into
Open
opentelemetry-util-http: don't raise on unparsable request targets#4965henry3260 wants to merge 1 commit into
henry3260 wants to merge 1 commit into
Conversation
henry3260
force-pushed
the
parse-url-query-invalid-url
branch
from
August 17, 2026 12:56
5999209 to
4c956ac
Compare
Pull request dashboard statusWaiting on maintainers · refreshed 2026-08-21 01:51 UTC Merge when ready. Status above doesn't look right?
|
…le request target so tornado no longer turns such requests into 500s
henry3260
force-pushed
the
parse-url-query-invalid-url
branch
from
August 17, 2026 16:32
4c956ac to
d45a910
Compare
xrmx
approved these changes
Aug 18, 2026
emdneto
approved these changes
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
_parse_url_queryinopentelemetry-util-httpcalledurlparseon request targets that comestraight off the request line.
urlparseraisesValueError("Invalid IPv6 URL") on targets suchas
//exa[mple, and because the exception propagated out of instrumentation, tornado turned thoserequests into 500s. It now returns empty components instead.
The components are deliberately not recovered by splitting on
?:url.queryis optional under thesemantic conventions, and every current caller sources
url.pathfrom the framework(
request.pathin tornado, the route template in asgi), so nothing downstream regresses. Preservingthe query for unparsable targets would be a separate change.
Related to #4447, which was closed by #4551 by avoiding
_parse_url_queryin the WSGIinstrumentation; the same root cause remained in the shared helper for the other callers.
Fixes # (issue)
Type of change
How Has This Been Tested?
util/opentelemetry-util-http/tests/test_parse_url_query.pycovers absolute urls,request-target-only urls, no query, empty url, and unparsable urls.
test_invalid_request_uri_does_not_break_requestasserts that//exa[mplestill answers 404 withhttp.targetandhttp.status_codeset. Reverting thehelper makes it fail with
500 != 404.uv run tox -e py313-test-util-http— 66 passed.uv run tox -e py313-test-instrumentation-tornado— 46 passed.test_remove_sensitive_paramsfails locally because
http_server_mockcannot bind port 5000; it fails the same way withoutthis change.
uv run pre-commit run ruff --all-filesandruff-formatpass.Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.