context-propagation
context-propagation copied to clipboard
Support Kotlin coroutines
Is your feature request related to a problem? Please describe.
Kotlin coroutines are stored in memory and have their own contexts and can be scheduled to resume on different threads.
ThreadLocal contexts won't work with coroutines out of the box.
Describe the solution you'd like
Support coroutines similar to the solution that was created for Slf4J MDC context: kotlinx-coroutines-slf4j
Describe alternatives you've considered
Additional context
- Documentation: https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/coroutine-context-and-dispatchers.md#thread-local-data
See https://github.com/Kotlin/kotlinx.coroutines/issues/119
this might help https://github.com/openzipkin/brave/issues/820#issuecomment-447614394
As I don't use Kotlin in production at this moment, I feel I would not be able to provide reasonable usecases for the tests to write.