Open afq984 opened 3 years ago
The trace callbacks are called in ClientResponse.read
:
https://github.com/aio-libs/aiohttp/blob/3be8a68d750fd9902106e747d11a0622b8650f2c/aiohttp/client_reqrep.py#L965-L973
I'd like to call the callbacks in StreamReader
, but it has non-blocking read_nowait
and feed_data
.
Any suggestions?
on_response_chunk_received
doesn't seem to be invoked on ClientResponse.content.iter_chunked()
, too.
Maybe ClientResponse
could have a .read_chunked()
method that would wrap .content.iter_chunked()
, calling send_response_chunk_received()
on each chunk?
Hey I see the issue is still open. I am looking to contribute here. Should I raise a PR for this ?
There is already an open PR to add the methods to the client class, listed above your comment.
I've not had a chance to review it yet, but I'd like to avoid having 2 methods to do the same thing, and one of them not being traced. So, if you think you have a good solution that makes tracing work on the existing methods, then please do open a PR.
Sure. I will work on it and raise the PR soon.
🐞 Describe the bug
TraceConfig.on_response_chunk_received
doesn't trace if the response body is read fromClientResponse.content
This behavior isn't obvious when looking at Tracing Reference, Streaming Response Content, ClientResponse.content
💡 To Reproduce
💡 Expected behavior
📋 Your version of the Python
📋 Your version of the aiohttp/yarl/multidict distributions