cle-b / httpdbg

A tool for Python developers to easily debug the HTTP(S) client requests in a Python program.
https://httpdbg.readthedocs.io/
Apache License 2.0
551 stars 13 forks source link

requests are not appearing in chronological order #133

Open benm5678 opened 8 months ago

benm5678 commented 8 months ago

In v 0.18.0 the request are not in order (can be seen by looking at Date in response headers). Is it possible to fix, or allow to sort? Thanks!!

cle-b commented 8 months ago

Hello,

Could you give me more context?

In httpdbg, the requests are ordered by the time of the first bytes sent by the client. There is one exception: if you use httpdbg to trace the requests when running tests in parallel using pytest. In that case the rule is the same, but for each test. Isn't it what you want?

NB: This order may differ than a sort based on the value of the HTTP response header Date but this is normal.

benm5678 commented 8 months ago

I'm doing sequential calls, so time of first byte should work. I suppose it's not an ordering issue, but a grouping issue. I see most requests grouped under the "console" heading. But others are split into their own "res = session.post" sections. So not all requests are under one section.... can that be done? I see if I hide initiator rows, the grouping sections go away, but it's still out of order in that case. Hopefully that makes sense.

cle-b commented 8 months ago

It looks like this is indeed a grouping issue.

I haven't been able to reproduce this issue but I tried to made a fix based on your description.

Could you try with httpdbg v0.18.1, select a request that was previously categorized under the "console" initiator and share with me the content of the stack panel, please?

Also, could you tell me what HTTP client you are using?

benm5678 commented 8 months ago

Nice, thanks for that. I can't repro the issue anymore, no requests show up under "console" anymore, so if I hide the initiator rows, I get a good sequential view. I'm not sure which request showed up under console and which didn't, it was kinda random before... behind the scenes it's an app that utilizes the latest langchain framework, so it's making the http calls. I can tell you that looking at the 200 POST requests, some of them have stack info and in others it's blank... so perhaps that's related.