Skip to content

Order exception handler inside observation interceptor - #439

Merged
dsyer merged 1 commit into
spring-projects:mainfrom
L00PLeGeNd:fix/grpc-438-observation-handled-status
Oct 9, 2026
Merged

dsyer merged 1 commit into
spring-projects:mainfrom
L00PLeGeNd:fix/grpc-438-observation-handled-status

Conversation

@L00PLeGeNd

Copy link
Copy Markdown
Contributor

Summary

  • Change GrpcExceptionHandlerInterceptor default order from HIGHEST_PRECEDENCE to 1 so it sits just inside Micrometer's ObservationGrpcServerInterceptor (@Order(0)).
  • Closing a mapped status then goes through ObservationGrpcServerCall#close, so grpc.server metrics record the handled code (e.g. NOT_FOUND) instead of UNKNOWN.
  • Add an in-process regression test covering the Boot-default interceptor ordering.

Fixes #438

Test plan

  • GrpcExceptionHandlerInterceptorTests
  • GrpcExceptionHandlerObservationTests
  • CI on this PR

Keep GrpcExceptionHandlerInterceptor just inside Micrometer's
ObservationGrpcServerInterceptor so mapped status codes reach
grpc.server metrics instead of falling back to UNKNOWN.

Fixes spring-projectsgh-438

Signed-off-by: Yinghuai Fu <328742512@qq.com>
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.

Handled exceptions are recorded as UNKNOWN in grpc.server observations (GrpcExceptionHandlerInterceptor runs outside ObservationGrpcServerInterceptor)

2 participants