-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
MDC attributes are not available on underlying thread #910
Comments
Hi @shikhahere01, Thanks! |
Hi @yufangong |
@shikhahere I'm a bit confused. Are you converting from a Twitter Util Future => Java Completable Future? I don't think that preserves MDC context by default. |
Yes that is correct. How do I preserve that ? |
It is ofcourse preserved on main thread. Just not in exception and timeout |
@mosesn any advice? |
@shikhahere01 @shikhahere as @yufangong asked and alluded to, for your code above are you accessing the MDC values from within the function scope of the MDCInitializer.let closure? If not the values will purposely not be visible outside of that closure. Also, have you taken a look at the documentation? https://twitter.github.io/finatra/user-guide/logging/mdc.html#usage as it mentions there this only works for Finagle managed contexts, that is this MDC integration won't work with Java Futures and you would need logic to copy over the MDC into the Java Future execution context. From your snippet it isn't clear exactly what constructs you're using but in the answer to @mosesn you seem to indicate you are converting and if that is the case, you will need to manually preserve MDC context during your conversion. Hope that helps. Thanks! |
Hi,
I am using the MDCInitializer and let method, to pass the MDC context from main thread to the underlying threads when asyncronus call is made.
I see that the MDC infomation is available on
http-nio-8081-exec-3
but not available on
finagle/netty4-2-29
and
Netty 4 Timer-1
so basically when the resonse is returned which is on different thread i dont see the MDC information available
Here is how my code looks like, what could be the reason here?
The text was updated successfully, but these errors were encountered: