Skip to content

Tracing method "on_request_start" does not receive full URL #7259

@selcukcihan

Description

@selcukcihan

Describe the bug

After a release in yarl which had a change in behaviour for URL's update_query aio-libs/yarl#854 (comment) method, the URL received in the on_request_start tracing hook lacks the query string part.

The problem only happens with yarl version 1.9.1. It works fine with previous version which is 1.8.2

To Reproduce

  1. Add a tracer
  2. Implement on_request_start for the tracer
  3. Issue a request that has a query string
  4. Observe that the params.url does not have the query string.

Expected behavior

I expect that the URL passed within params to the tracer hook contains the query string part as well and resembles the original URL exactly.

Logs/tracebacks

See https://github.com/aio-libs/yarl/issues/854#issuecomment-1521670598 please for the exact issue that's causing this problem

Python Version

$ python --version
Python 3.9.16 (main, Mar 15 2023, 15:55:54) 
[Clang 14.0.0 (clang-1400.0.29.202)] on darwin

aiohttp Version

$ python -m pip show aiohttp
3.8.4

multidict Version

$ python -m pip show multidict
6.0.4

yarl Version

$ python -m pip show yarl
1.9.1 (the issue is not seen with version 1.8.2 as explained above)

OS

macOS

Related component

Client

Additional context

In this piece of the code

await trace.send_request_start(method, url.update_query(params), headers)
params is None and the url actually has the query string in it. But the call to url.update_query(params) is removing the query string which is passed to the tracing hook method.

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions