Tracing Coroutines on a JVM
May 04, 2023
10 min
Free
kotlin
threadlocal
coroutines
jvm
tracing
opentelemetry
distributed-tracing
java
concurrency
performance-monitoring
kotlin-coroutines
Description
This talk by Tyson Henning addresses the challenges of propagating tracing information, such as OpenTelemetry or Dapper, through coroutines on the JVM. It delves into the problem's discovery and presents a solution using `CopyableThreadContextElement` to safely propagate traces in hybrid Java Executor/Kotlin Coroutine environments by leveraging `ThreadLocal` storage. The discussion covers how this mechanism ensures accurate traces and simplifies span syntax when integrating with existing Java and JVM infrastructure.