Please describe the feature request.
Let's say that we have a gRPC server written in kotlin with coroutines support enabled:
class ExampleServer(private val registry: ObservationRegistry) :ServiceGrpcKt.CoroutineImplBase() {
override suspend fun exampleMethod(request: Request): Response {
// logic
}
And let's assume that ObservationGrpcServerInterceptor was added as an interceptor.
When we try to get the current observation from the registry, it always return null, which is expected as suspended function are ran in a different thread:
override suspend fun exampleMethod(request: Request): Response {
this.registry.currentObservation // returns null
}
I wonder how we can fix this, so that we can get the current observation the same as we do for blocking API.
It would be nice if the existing function could be used to retrieve the current observation created by the interceptor:
class ExampleServer(private val registry: ObservationRegistry) :ServiceGrpcKt.CoroutineImplBase() {
override suspend fun exampleMethod(request: Request): Response {
coroutineContext.currentObservation()
}
Rationale
It is currently not possible to create a child observation based on the parent one that was created in the gRPC Server Interceptor.
Additional context
#3256
Please describe the feature request.
Let's say that we have a gRPC server written in kotlin with coroutines support enabled:
And let's assume that
ObservationGrpcServerInterceptorwas added as an interceptor.When we try to get the current observation from the registry, it always return null, which is expected as suspended function are ran in a different thread:
I wonder how we can fix this, so that we can get the current observation the same as we do for blocking API.
It would be nice if the existing function could be used to retrieve the current observation created by the interceptor:
Rationale
It is currently not possible to create a child observation based on the parent one that was created in the gRPC Server Interceptor.
Additional context
#3256