opentelemetry-java-instrumentation: Kotlin coroutine missing trace
Describe the bug
Code snippet from a gRPC ClientInterceptor
:
private fun getOrCreateUuid(userId: String): String {
...
CoroutineScope(AppGlobal.IODispatcher + AppGlobal.ExceptionHandler).launch {
uuidRepository.save(uuid)
LOG.debug("Saved user id: {} in the DB", userId)
}
}
The log statement is missing trace and span, but log statements outside the launch
coroutine have trace and span.
Steps to reproduce
Launch a coroutine from inside a gRPC ClientInterceptor
.
What did you expect to see? Trace and span in the log statements.
What did you see instead? Trace and span missing in the log statements.
What version are you using? v0.9.0
Environment N/A.
Additional context N/A.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 48 (23 by maintainers)
Thanks for the app @asarkar. Since that time, the behavior of the SDK changed to default to being completely no-op - you have to configure the SDK yourself once to set it up. I changed your app to have an
implementation
dependency onio.opentelemetry:opentelemetry-sdk
and modifiedApplication
to beand it seems to work ok.
FYI, in the next release, the entrypoint to gRPC will change to
GrpcTracing.create(openTelemetry).newServerInterceptor()
/GrpcTracing.create(openTelemetry).newClientInterceptor()
@asarkar The latest snapshots of the SDK include a new artifact,
opentelemetry-extension-kotlin
which includes the helper method.https://github.com/open-telemetry/opentelemetry-java/blob/master/extensions/kotlin/src/main/kotlin/io/opentelemetry/extension/kotlin/ContextExtensions.kt