-
Couldn't load subscription status.
- Fork 73
Description
Description
I've hit on a crucial and subtle point about tracing in a multi-threaded, multi-client environment.
When different auth-token requirements exist, we cannot use a single shared OkHttpClient; each client needs its own configuration.
The bigger issue, however, is that spans are not linking correctly due to how context is managed across different threads with Kotlin coroutines.
I have added the following:
runBlocking(ioDispatcher + Context.current().asContextElement()) {
// tasks
}
Expected Behavior
The active span context should propagate correctly to child coroutines and OkHttp interceptors, so that spans are properly linked.
Actual Behavior
Context is lost when switching threads in runBlocking, causing spans to appear disconnected (no parent span).