Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Conversation

nhtgl
Copy link

@nhtgl nhtgl commented Jan 24, 2023

In httpx Advanced Usage docs there is a chapter Request Instances where they show alternative way of sending requests, where you can use once initialized client to send various of different requests to the same host.

Current implementation of tracing doesn't cover that use case, because calling structure is different while function Client.send is actually what is common and it returns Response object.

In a nutshell:

class Client:
    ...
    def request(...) -> Response:
        ...
        request = self.build_request(...)
        return self.send(request)

so when I have something like this:

req_1 = httpx.Request(...)
req_2 = httpx.Request(...)

with httpx.Client() as client:
    client.send(req_1)
    client.send(req_2)

It's not traced.

The solution in this PR will cover both use cases - the standard one (requests-like) and the advanced usage.

@miqm
Copy link

miqm commented Jan 26, 2023

@macieyng update the changelog

@nhtgl
Copy link
Author

nhtgl commented Feb 2, 2023

Thanks @lzchen for running the pipeline. I will fix it tomorrow.

@nhtgl
Copy link
Author

nhtgl commented Feb 3, 2023

@lzchen ready for running the pipeline 🚀
My bad for not running tox locally before pushing. It turns out that implementation has to be a little bit different from requests.
@inirudebwoy can you review this too, please?

@nhtgl
Copy link
Author

nhtgl commented Feb 6, 2023

@lzchen can you run the pipeline? Thanks! 🙏

@nhtgl
Copy link
Author

nhtgl commented Feb 7, 2023

@nhtgl
Copy link
Author

nhtgl commented Feb 8, 2023

Failed to import opencensus.ext.zipkin.trace_exporter.
Possible hints:
* AttributeError: module 'opencensus' has no attribute 'ext'
* ModuleNotFoundError: No module named 'opencensus.ext'
Failed to import opencensus.ext.stackdriver.trace_exporter.
Possible hints:
* AttributeError: module 'opencensus' has no attribute 'ext'
* ModuleNotFoundError: No module named 'opencensus.ext'

That's not something that I touched and on my machine it fails even earlier, but that's because I'm running it locally on mac. @lzchen can I get your support with sorting this out?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants