Skip to content

How do I pass MDC Context while using virtual threads in DGS and Spring Boot? #1873

Answered by paulbakker
govi20 asked this question in Q&A
Discussion options

You must be logged in to vote

So the short answer is that you'll need to propagate the context that's on thread locals some way. The best option is probably to leverage MicroMeter Context, which Spring Boot is now standardizing on. To integrate that with DGS you'll have to provide an ExecutorService as a bean, where that bean is configured to be context propagation enabled.
We're doing exactly that at Netflix, since our Spring Boot extensions take care of that.
Doing something like that manually will unblock this for you.

I'm also starting to realize that we should probably do something better out of the box. I'll think about that some more, but it will technically be about the same thing.
Also, I'm wondering if you h…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by govi20
Comment options

You must be logged in to vote
4 replies
@govi20
Comment options

@paulbakker
Comment options

@govi20
Comment options

@paulbakker
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants