-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass X-Request-Id if present #3072
Pass X-Request-Id if present #3072
Conversation
- pass the X-Request-Id header value if present, pass generated UUID if the header not present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine, aside from the conflict markers left unresolved.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3072 +/- ##
=======================================
Coverage 76.21% 76.22%
=======================================
Files 211 211
Lines 7821 7824 +3
=======================================
+ Hits 5961 5964 +3
Misses 1860 1860
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautamous
These changes are now available in 4.83.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly considering this header doesn't make an appearance in MDN, I wouldn't hard-code it like this 🤔
I would instead add a configuration option so other users can configure it "based on headers", and there they could specify the "X-Request-ID" header.
I know this complicates the solution, but we have "tracing" and "task-locals" for logging now which enable you to this yourself to some extent, and caring about this particular header seems out of scope for Vapor to me.
To be clear I still like the idea and I can think of some nice use cases for it.
@MahdiBM I disagree - (And as for it being out of scope, we put Vapor into the scope of caring about request IDs when we made it generate random ones by default.) |
Pass the value from the X-Request-Id to the logger context
Mentioned:
Why:
Inspiration: