From c79180980ca5f7839d9a4a53f483f4794a1ce758 Mon Sep 17 00:00:00 2001 From: Aliaksandr Mianzhynski Date: Tue, 22 Sep 2020 21:15:05 +0300 Subject: [PATCH] Return grpc serving status in health check errors --- agent/checks/grpc.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/agent/checks/grpc.go b/agent/checks/grpc.go index dea6a84cf..d1bf6b900 100644 --- a/agent/checks/grpc.go +++ b/agent/checks/grpc.go @@ -13,8 +13,6 @@ import ( "google.golang.org/grpc/resolver" ) -var ErrGRPCUnhealthy = fmt.Errorf("gRPC application didn't report service healthy") - // GrpcHealthProbe connects to gRPC application and queries health service for application/service status. type GrpcHealthProbe struct { server string @@ -69,8 +67,8 @@ func (probe *GrpcHealthProbe) Check(target string) error { if err != nil { return err } - if response == nil || response.Status != hv1.HealthCheckResponse_SERVING { - return ErrGRPCUnhealthy + if response.Status != hv1.HealthCheckResponse_SERVING { + return fmt.Errorf("gRPC %s serving status: %s", target, response.Status) } return nil