Skip to content
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

fix: changes grpc server exception handler order #1134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

s4kas
Copy link

@s4kas s4kas commented Aug 15, 2024

This PR adds the GrpcExceptionInterceptor bean after the ObservationGrpcServerInterceptor and the MetricCollectingServerInterceptor and before the ExceptionTranslatingServerInterceptor.
This is necessary in order to allow the later interceptor to process the error response after the exception handler is executed, more precisely to add the returned status code to the context/meter.

Im not entirely sure but i believe this was an unintentional consequence of the added support for Order because the GrpcAdviceAutoConfiguration already had the @Order with the 0 precedence it was just not doing anything.

fixes #789 #1088

@s4kas s4kas marked this pull request as ready for review August 15, 2024 16:52
@brumarqu-te
Copy link

/review @ST-DDT

Comment on lines +107 to +109
public void error(Empty request, StreamObserver<Empty> responseObserver) {
throw new RuntimeException("a simulated error");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add a streaming variant of this test.

Also I'm thinking of whether we should have an additional test for responseObserver.onError(exception) in addition to just throwing inside the method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server metrics are tagged with the wrong status codes
3 participants