Skip to content

Add List method to gRPC Health service #8155

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

marcoshuck
Copy link

This change introduces a new List RPC endpoint for the Health service, allowing clients to retrieve the statuses of all monitored services. This feature simplifies integration with status-reporting dashboards and enhances observability for microservices.

Proposal: grpc/proposal#468
gRPC-proto change: grpc/grpc-proto#143

This change introduces a new `List` RPC endpoint for the Health service, allowing clients to retrieve the statuses of all monitored services. This feature simplifies integration with status-reporting dashboards and enhances observability for microservices.

Proposal: grpc/proposal#468
gRPC-proto change: grpc/grpc-proto#143
Signed-off-by: Marcos Huck <[email protected]>
Copy link
Author

Choose a reason for hiding this comment

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

I regenerated the Go stubs using the work in progress version of grpc/grpc-proto#143

Copy link
Author

Choose a reason for hiding this comment

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

I regenerated the Go stubs using the work in progress version of grpc/grpc-proto#143

Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.02%. Comparing base (732f3f3) to head (8a7e2a3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8155      +/-   ##
==========================================
- Coverage   82.09%   82.02%   -0.07%     
==========================================
  Files         412      412              
  Lines       40491    40503      +12     
==========================================
- Hits        33242    33224      -18     
- Misses       5876     5896      +20     
- Partials     1373     1383      +10     
Files with missing lines Coverage Δ
health/server.go 95.65% <100.00%> (+0.65%) ⬆️

... and 19 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@purnesh42H purnesh42H left a comment

Choose a reason for hiding this comment

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

@marcoshuck i think we need to wait for the proposal and proto change to be merged before this? I still see them in review

@dfawley cc

@purnesh42H purnesh42H added Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability Type: Feature New features or improvements in behavior Status: Requires Reporter Clarification labels Mar 10, 2025
Copy link

This PR is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.

@github-actions github-actions bot added the stale label Mar 19, 2025
@marcoshuck marcoshuck requested a review from purnesh42H March 19, 2025 23:07
@github-actions github-actions bot removed the stale label Mar 20, 2025
@dfawley dfawley assigned purnesh42H and unassigned marcoshuck Mar 20, 2025
@dfawley dfawley added Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability and removed Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability labels Mar 20, 2025
@purnesh42H purnesh42H assigned marcoshuck and unassigned purnesh42H Mar 24, 2025
marcoshuck and others added 3 commits March 24, 2025 12:54
Signed-off-by: Marcos Huck <[email protected]>
@marcoshuck marcoshuck requested a review from purnesh42H March 24, 2025 15:57
@purnesh42H
Copy link
Contributor

@marcoshuck could you resolve the merge conflicts?

}
}

// TestListResourceExhausted verifies that the service status list returns an error when it exceeds
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: restrict the comments to 80 cols

Copy link
Contributor

@purnesh42H purnesh42H left a comment

Choose a reason for hiding this comment

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

lgtm. Please wrap comments under 80 cols per line.

@@ -30,6 +30,12 @@ import (
"google.golang.org/grpc/status"
)

const (
// maxAllowedServices defines the maximum number of resources a List operation can return.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: wrap comments to 80 cols per line.

if len(out.GetStatuses()) != len(s.statusMap) {
t.Fatalf("len(out.GetStatuses()) = %d, want %d", len(out.GetStatuses()), len(s.statusMap))
}
for key := range out.GetStatuses() {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: for k, v := range out.GetStatuses() then don't need line 115

t.Fatalf("s.List(ctx, &in) return nil error, want non-nil")
}
if !errors.Is(err, status.Errorf(codes.ResourceExhausted, "server health list exceeds maximum capacity: %d", maxAllowedServices)) {
t.Fatal("List should have failed with resource exhausted")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
t.Fatal("List should have failed with resource exhausted")
t.Fatal("s.List() = %v, want %v, err, status.Errorf(codes.ResourceExhausted, "server health list exceeds maximum capacity: %d", maxAllowedServices)")

@purnesh42H
Copy link
Contributor

Could you run ./scripts/vet.sh to catch vet errors and fix them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Observability Includes Stats, Tracing, Channelz, Healthz, Binlog, Reflection, Admin, GCP Observability Status: Requires Reporter Clarification Type: Feature New features or improvements in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants