Skip to content
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

Support Micronaut 4 Context Propagation #994

Open
jjathman opened this issue Nov 16, 2023 · 2 comments
Open

Support Micronaut 4 Context Propagation #994

jjathman opened this issue Nov 16, 2023 · 2 comments
Assignees

Comments

@jjathman
Copy link
Contributor

Feature description

With Micronaut 4, how context propagation works (specifically something like SFL4J's MDC) was reworked using a new API documented here. It doesn't appear as though the GCP libraries are supporting this.

For example, when using the reactive PubSub client, any logging done within a map/doOnSuccess/doOnError call does not have the MDC from the calling thread even when the context propagation is setup.

Would it be possible to support this? I'm not sure what needs to change to enable this feature.

@jeremyg484 jeremyg484 self-assigned this Jan 8, 2024
@SushmaReddyLoka
Copy link

SushmaReddyLoka commented Nov 15, 2024

@jeremyg484 , @graemerocher can you help on this.
We upgraded to micronaut 4.6.6 and are seeing similar issue with project reactor calls, we have logs in doOnSuccess and context is missing in them. Also after switching back from reactor thread to default-nioEventLoopGroup-xx, the context which was originally set on default-nioEventLoopGroup-xx is also lost.

First we upgraded to 4.6.6 and observed that MDC.getCopyOfContextMap() was returning null altogether so we went ahead and added implementation("io.micrometer:context-propagation"), now we don't see NPE as MDC is having PropagationContext in it, but the rest of context is still lost.

We have been extending reactor.core.CoreSubscriber, and copying the currentContext() to MDC so far for context propogation.

Created Q/A for the same at micronaut-projects/micronaut-core#11346

@graemerocher
Copy link
Contributor

maybe provide a reproducer please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants