<@U05P455RFFD> Heya, I was just wondering why the ...
# ktor
r
@Jeff Hudson Heya, I was just wondering why the
withMdc
function was removed from Kairo in v6, or was it just moved somewhere else? https://github.com/hudson155/kairo/blob/v5.15.1/kairo-mdc/src/main/kotlin/kairo/mdc/withMdc.kt
j
oh great question! I do want to bring it back before Kairo 6 goes from Beta to GA https://github.com/hudson155/kairo/issues/728 If you want to try out Kairo 6 Beta, I can prioritize this ticket 🙂
It's not left out for any particular reason. I just haven't gotten to it yet in the V6 rewrite
r
Ah gotcha, yeah I was just wondering as I've referenced it for bridging using MDC within coroutines and noticed it missing from the repo, was wondering if there was a better way found to do the same thing.
j
I think the strategy will remain the same in V6, but I'll follow up in this thread if we find a different/better solution 🙂
r
Thanks! My understanding is the weirdness is because MDC lives in java threads, is that correct?
j
Right, MDC by default uses thread-local variables, but Kotlin Coroutines aren't guaranteed to be picked up by the same thread after suspend points, so some adapter code is required to ensure that everything works properly
r
Makes me wonder if there's been any Kotlin-friendly but slf4j-compatible rewrites attempted yet.
j
yeah I wonder — I haven't looked recently but I'm sure someone will eventually Also idk how it works with Java virtual threads?
r
Oh cool, so Ktor does have something builtin for it, just hiding in plain sight
But that's an
internal
func...
j
Yeah they use it internally as part of their
CallLogging
plugin
r
Methinks there should probably be a public function available as part of Ktor for this since I'd think it would be commonly desired
j
💯