Hi guys. Is there any way to pass MDC to frame pro...
# kotlinx-rpc
y
Hi guys. Is there any way to pass MDC to frame processing (actual RPC service logic)? I see that it is correctly set by CallId Ktor plugin for upgrade request, but then it is lost. I do not see any place in API where I can hook it up.
Probably the main cause of the problem is here: https://github.com/Kotlin/kotlinx-rpc/blob/main/krpc/krpc-server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/internal/RPCServerService.kt#L175 Actual RPC service logic is called in the RPC service coroutine context (Empty Supervisor Job) instead of transport coroutine context (that has MDCContext). My naive approach would be to make the method suspended and launch service call on
kotlin.coroutines.coroutineContext
, but probably it will break control flow. @Alexander Sysoev wdyt?
a
@Yakiv Yereskovskyi hey!
Not sure wdym by
Empty Supervisor Job
, the task is called on a service scope, which in turn is a child of the transport
Can you please describe your problem in a bit more details, I'm not sure I'm following it right now
y
Problem: I have CallID ktor plugin installed, it sets correct MDC for SLF4J, but it is lost during actual service logic (that probably means that it is called in different than transport coroutine context)
a
Hm, ok May I ask you please to file a issue on GitHub and provide a simple reproducer for it?
y
the task is called on a service scope, which in turn is a child of the transport
as I see, yes, it is a child of transport job, but transport context is lost, it is just a supervisor job that depends on parent: https://github.com/Kotlin/kotlinx-rpc/blob/f7c135b99ef3124ee76a719e2243c2012f9ca53[…]server/src/jvmMain/kotlin/kotlinx/rpc/krpc/server/KRPCServer.kt
May I ask you please to file a issue on GitHub and provide a simple reproducer for it?
sure, I’ll create a simple issue first, and they will try to find a time to write a reproducer
thank you color 1