This Plugin provides an auto instrument support plugin for Kotlin coroutine based on context snapshot.
SkyWalking provide tracing context propagation inside thread. In order to support Kotlin Coroutine, we provide this additional plugin.
As we know, Kotlin coroutine switches the execution thread by CoroutineDispatcher
.
- Create a snapshot of the current context before dispatch the continuation.
- Then create a coroutine span after thread switched, mark the span continued with the snapshot.
- Every new span which created in the new thread will be a child of this coroutine span. So we can link those span together in a tracing.
- After the original runnable executed, we need to stop the coroutine span for cleaning thread state.
We run a Kotlin coroutine based gRPC server without this coroutine plugin.
You can find, the one call (client -> server1 -> server2) has been split two tracing paths.
Without changing codes manually, just install the plugin. We can find the spans be connected together. We can get all info of one client call.