From 3aac5dabaa7fbf0e00905bd8f82534ff1236b887 Mon Sep 17 00:00:00 2001 From: Marcos Huck Date: Mon, 12 Feb 2024 01:48:13 -0300 Subject: [PATCH 1/2] Add List method to Health service --- grpc/health/v1/health.proto | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/grpc/health/v1/health.proto b/grpc/health/v1/health.proto index 13b03f56..e377a908 100644 --- a/grpc/health/v1/health.proto +++ b/grpc/health/v1/health.proto @@ -39,6 +39,14 @@ message HealthCheckResponse { ServingStatus status = 1; } +message HealthListRequest { + repeated string services = 1; // Contains the name of the services that should be obtained. If empty, must returns all. +} + +message HealthListResponse { + map services_statuses = 2; // Contains all the service and their respective status. +} + // Health is gRPC's mechanism for checking whether a server is able to handle // RPCs. Its semantics are documented in // https://github.com/grpc/grpc/blob/master/doc/health-checking.md. @@ -54,6 +62,19 @@ service Health { // Check implementations should be idempotent and side effect free. rpc Check(HealthCheckRequest) returns (HealthCheckResponse); + // List gets the health of all the available services. A filtered list can + // be obtained by sending the list of the respective service names. If the + // list of service names is empty must return all the available services. + // + // Use case: Integrate servers and status report dashboards. + // + // Clients should set a deadline when calling List, and can declare the + // server unhealthy if they do not receive a timely response. + // + // + // List implementations should be idempotent and side effect free. + rpc List(HealthListRequest) returns (HealthCheckResponse); + // Performs a watch for the serving status of the requested service. // The server will immediately send back a message indicating the current // serving status. It will then subsequently send a new message whenever From 76a6dc18c0ad40304415aacd0d72f153ff176232 Mon Sep 17 00:00:00 2001 From: Marcos Huck Date: Thu, 19 Dec 2024 00:02:45 -0300 Subject: [PATCH 2/2] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Krämer --- grpc/health/v1/health.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grpc/health/v1/health.proto b/grpc/health/v1/health.proto index e377a908..7751b281 100644 --- a/grpc/health/v1/health.proto +++ b/grpc/health/v1/health.proto @@ -44,7 +44,7 @@ message HealthListRequest { } message HealthListResponse { - map services_statuses = 2; // Contains all the service and their respective status. + map statuses = 1; // Contains all the services and their respective status. } // Health is gRPC's mechanism for checking whether a server is able to handle @@ -64,7 +64,7 @@ service Health { // List gets the health of all the available services. A filtered list can // be obtained by sending the list of the respective service names. If the - // list of service names is empty must return all the available services. + // list of service names is empty, all the available services must be returned. // // Use case: Integrate servers and status report dashboards. //