Public API for accessing connection pool details #2966
Unanswered
RobertCraigie
asked this question in
Ideas
Replies: 1 comment 6 replies
-
Gentle bump, is this something you'd consider @tomchristie ? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
(Apologies if this already exists and I've just missed this)
There doesn't appear to be a public API for accessing any details about the number of open connections / requests in a connection pool.
I recently ran into a bug where we weren't properly releasing connections back to the connection pool in certain scenarios and I'd love to be able to write unit tests to cover this case and add debug logs without relying on an internal API.
For reference this is the internal API I used for testing:
This makes use of:
httpx.Client._transport
httpx.HTTPTransport._pool
httpcore.ConnectionPool._pool
httpcore.ConnectionPool._requests
The first private property access could be obviated by instantiating the transport directly but that unfortunately isn't possible in my case.
Beta Was this translation helpful? Give feedback.
All reactions