Make built-in MDC key `req.id` give `requestId` of root `ServiceRequestContext`
See original GitHub issueCurrently, MDC key, req.id, evaluates to requestId of ClientRequestContext even if it has ServiceRequestContext as its root. This undermines the benefit of using MDC as the logs within ClientRequestContext don’t leave any contextual information of which service request they are scoped to.
I wonder if this is an intended behavior and I should introduce a custom MDC key to trace client logs within a span of service request.
If not, a simple fix for BuiltInProperty.REQ_ID will do the work:
// AS-IS
REQ_ID("req.id", log -> log.context().id().text())
// TO-BE
REQ_ID("req.id", log -> log.context().root() != null ? log.context().root().id().text()
: log.context().id().text())
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Index (Armeria 1.7.2 API reference) - Javadoc.io
Returns whether a given request should be treated as failed before it is ... Returns the Maven artifact ID of the component, such...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

req.rootOrSelfId? 😆Right, I will work in that way!