-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Don't replace an existing request id header #7
Conversation
Sorry for the late answer. This looks good but I want to properly review the changes. This might take a few days. |
Ok I had a look at the changes and it seems fine. I just think there should be a way to disable the behavior of using the supplied request id from the request. Something like a boolean flag |
Is the boolean to replace the I don't see the usage of having one request id comming from the load balancer that we need to replace by the new one… it will break the entire tracking/observability |
Some apps might not be running behind a load balancer. In this case any request coming from a user might include the request id header. In this case it might not be acceptable to use the supplied id value. And I found a bug in your PR: the Add the following lines to your testcase to reproduce: let body: Bytes = test::read_body(resp).await;
let body = String::from_utf8_lossy(&body);
assert_eq!(body, uuid4); |
Strange, I ran 50k call (with and without request id in request header) on an API and 0 error between request header and response header and no missing or malformed request id in the response header. I'll try with your snippet |
The bug happens here: https://github.com/vbrandl/actix-request-identifier/blob/master/src/lib.rs#L174 This line makes I also think, calling the id generator should happen in the |
I pushed code for both points:
I'm still not sure, which one should be the default. Using |
Maybe I broke something but implementing this version without To reproduce:
Only 2 different request id on 6 requests:
You can try it on other endpoints (just look at the readme to have If I put |
I ran 26 requests and the request id is different each time as expected (commit 51fd7dc) |
I cannot reproduce the issue you described. I just pulled and ran the docker image and I get random ids:
Removing/keeping the Edit: I saw you pushed to the |
I just built sycured/streaming_calc_actixweb@fdc7bff0 with the Edit: It seems like you deleted your answer. Could you investigate and provide a minimal testcase to reproduce (best case would be in the form of a unit test) and if you are not able to reproduce, revert the commit 51fd7dc |
On it, I'm running some |
Everything is fine on my tests with the commit removed edit: the issue was when using Docker Desktop 4.15.0 on my workstation, now I'm using another engine, and no issue. Nothing changed at OS level |
Weird and probably worth opening a bug report against docker desktop. I just realized, this crate is already on a stable version. I plan to match the crate version to actix, so creating a 5.0.0 release will break this. Would you also be ok with keeping the current default behavior but being able to configure I can introduce the breaking change with the new actix release, when I bump this crate to 5.0.0. |
No problem for me |
Thanks for your help and sorry, it took so long to finish and for being so picky but I merged your changes and just published the new release to crates.io: https://crates.io/crates/actix-request-identifier/4.1.0 |
No problem, thank you |
Fix #6