-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ObservationGrpcServerInterceptor does not store observation in a context #4218
Comments
This commit contains changes that allow to capture current observation when using kotlin gRPC coroutine server. In order to properly propagate current Observation to a coroutine server method, we need to propagate Observation as a context element by extending `CoroutineContextServerInterceptor`. Moreover, current Observation needs to be somehow allowed to capture by `CoroutineContextServerInterceptor`. To do this, we need to open current Observation scope inside `ObservationGrpcServerInterceptor`. It is important to keep these two interceptors in a proper order - first, we need to open current Observation scope, and later create a context element based on it. Fixes: micrometer-metrics#4218
This commit contains changes that allow to capture current observation when using kotlin gRPC coroutine server. In order to properly propagate current Observation to a coroutine server method, we need to propagate Observation as a context element by extending `CoroutineContextServerInterceptor`. Moreover, current Observation needs to be somehow allowed to capture by `CoroutineContextServerInterceptor`. To do this, we need to open current Observation scope inside `ObservationGrpcServerInterceptor`. It is important to keep these two interceptors in a proper order - first, we need to open current Observation scope, and later create a context element based on it. Fixes: micrometer-metrics#4218
This commit contains changes that allow to capture current observation when using kotlin gRPC coroutine server. In order to properly propagate current Observation to a coroutine server method, we need to propagate Observation as a context element by extending `CoroutineContextServerInterceptor`. Moreover, current Observation needs to be somehow allowed to capture by `CoroutineContextServerInterceptor`. To do this, we need to open current Observation scope inside `ObservationGrpcServerInterceptor`. It is important to keep these two interceptors in a proper order - first, we need to open current Observation scope, and later create a context element based on it. Fixes: micrometer-metrics#4218
This commit contains changes that allow to capture current observation when using kotlin gRPC coroutine server. In order to properly propagate current Observation to a coroutine server method, we need to propagate Observation as a context element by extending `CoroutineContextServerInterceptor`. Moreover, current Observation needs to be somehow allowed to capture by `CoroutineContextServerInterceptor`. To do this, we need to open current Observation scope inside `ObservationGrpcServerInterceptor`. It is important to keep these two interceptors in a proper order - first, we need to open current Observation scope, and later create a context element based on it. Fixes: micrometer-metrics#4218
So it seems there is a missing instrumentation and not the existing one having some bugs, right? |
@jonatan-ivanov I don't think that the discussion you have mentioned is related, though. It seems to be about context propagation to the REST calls, and in my case it is gRPC call 🙂 I will be happy if you can take a look at the PR that I provided 🙂 |
Thank you @AleksanderBrzozowski for your PR. We will look into that ASAP (we haven't forgotten about your PR :) ) |
@marcingrzejszczak Thanks! 🙂 I haven't forgotten either! 😄 |
@marcingrzejszczak Hello! :) How is it going? Were you able to take a look at the PR? :) |
Not yet, the PR however needs some conflict resolution. |
@AleksanderBrzozowski Can you fix conflicts, please. I have same problem and I am waiting this fix :) |
Yup, I will try to fix conflicts today 🙂 |
This commit contains changes that allow to capture current observation when using kotlin gRPC coroutine server. In order to properly propagate current Observation to a coroutine server method, we need to propagate Observation as a context element by extending `CoroutineContextServerInterceptor`. Moreover, current Observation needs to be somehow allowed to capture by `CoroutineContextServerInterceptor`. To do this, we need to open current Observation scope inside `ObservationGrpcServerInterceptor`. It is important to keep these two interceptors in a proper order - first, we need to open current Observation scope, and later create a context element based on it. Fixes: micrometer-metrics#4218
This commit contains changes that allow to capture current observation when using kotlin gRPC coroutine server. In order to properly propagate current Observation to a coroutine server method, we need to propagate Observation as a context element by extending `CoroutineContextServerInterceptor`. Moreover, current Observation needs to be somehow allowed to capture by `CoroutineContextServerInterceptor`. To do this, we need to open current Observation scope inside `ObservationGrpcServerInterceptor`. It is important to keep these two interceptors in a proper order - first, we need to open current Observation scope, and later create a context element based on it. Fixes: micrometer-metrics#4218
This commit contains changes that allow to capture current observation when using kotlin gRPC coroutine server. In order to properly propagate current Observation to a coroutine server method, we need to propagate Observation as a context element by extending `CoroutineContextServerInterceptor`. Moreover, current Observation needs to be somehow allowed to capture by `CoroutineContextServerInterceptor`. To do this, we need to open current Observation scope inside `ObservationGrpcServerInterceptor`. It is important to keep these two interceptors in a proper order - first, we need to open current Observation scope, and later create a context element based on it. Fixes: micrometer-metrics#4218
Conflicts fixed, @marcingrzejszczak you can proceed with review 😃 |
…er (#4284) * add support for Observation propagation in kotlin gRPC coroutine server This commit contains changes that allow to capture current observation when using kotlin gRPC coroutine server. In order to properly propagate current Observation to a coroutine server method, we need to propagate Observation as a context element by extending `CoroutineContextServerInterceptor`. Moreover, current Observation needs to be somehow allowed to capture by `CoroutineContextServerInterceptor`. To do this, we need to open current Observation scope inside `ObservationGrpcServerInterceptor`. It is important to keep these two interceptors in a proper order - first, we need to open current Observation scope, and later create a context element based on it. Fixes: #4218 * set license & set 'since' property for a public class --------- Co-authored-by: Aleksander Brzozowski <aleksander.brzozowski@sinch.com>
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
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:
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
The text was updated successfully, but these errors were encountered: