Skip to content

Conversation

@ZY-Ang
Copy link
Contributor

@ZY-Ang ZY-Ang commented Sep 10, 2025

References to other Issues or PRs

Have you read the Contributing Guidelines?

Yes

Brief description of what is fixed or changed

Enhanced Context Annotation for Health Check Endpoint

What's Changed

Added proper context annotation to the health check endpoint handler, including:

  • GRPC method name annotation (grpc_health_v1.Health_Check_FullMethodName)
  • HTTP path pattern information
  • Server metadata handling for GRPC headers and trailers

Why

The current implementation passes the raw context directly to the health check client without any GRPC Gateway-specific annotations. This means:

  1. Observability tools and middleware can't properly trace the GRPC method being called
  2. The HTTP endpoint information is not propagated through the context
  3. GRPC metadata (headers/trailers) are not being handled

Benefits

  • Improved observability: Tracing and monitoring tools can now see the full request path from HTTP to GRPC
  • Consistent behavior: The health endpoint now follows the same context annotation pattern as other endpoints
  • Better debugging: Full context information available throughout the request lifecycle
  • Proper metadata handling: GRPC headers and trailers are now properly managed

Testing

The changes maintain existing functionality while adding context enrichment. All existing health check behaviors remain unchanged.

Other comments

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

Thanks, this looks great!

@johanbrandhorst
Copy link
Collaborator

Looks like we need to generate the bazel files, try running the command in CONTRIBUTING.md

@ZY-Ang
Copy link
Contributor Author

ZY-Ang commented Sep 14, 2025

@johanbrandhorst thanks and fixed - I might have missed a couple of errors the first time I ran the commands.

@johanbrandhorst johanbrandhorst merged commit 838f448 into grpc-ecosystem:main Sep 14, 2025
14 checks passed
@johanbrandhorst
Copy link
Collaborator

Thanks!

@ZY-Ang ZY-Ang deleted the annotate-healthz-endpoint branch September 15, 2025 01:31
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.

2 participants