-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
enhancementA general enhancementA general enhancement
Milestone
Description
Hi,
cancelled status codes are not reported in the gRPC server metrics, metrics in these cases are reported without the tag status code because GrpcServerObservationContext
is not updated with the cancelled. For us it's important the gRPC server metric give us info of the status codes, and this could be improved for example modifying the onCancel
method of the ObservationGrpcServerCallListener
before running the stop operation, something like this:
@Override
public void onCancel() {
try (final Scope scope = this.observation.openScope()) {
super.onCancel();
} finally {
if (this.observation.getContext() instanceof final GrpcServerObservationContext obsCtx) {
obsCtx.setStatusCode(Status.Code.CANCELLED);
}
this.observation.stop();
}
}
I have created a demo to reproduce easily cancelleds, the service has a delay of 5 seconds to give time to the client to cancel the request, you could make the call using postman or a simple grpc client with a deadline lower than 5 seconds.
Thanks for your time.
juliojgd
Metadata
Metadata
Assignees
Labels
enhancementA general enhancementA general enhancement