From 837f659e850462a603132fa1b0093a9f5645e4d9 Mon Sep 17 00:00:00 2001 From: HuKeping Date: Thu, 7 Jan 2016 21:55:23 +0800 Subject: [PATCH] Add more information to health check Prior to this patch, if the MySQL for signer down, the health check of Server just warning out: - "Trust not fully operational: Trust is not healthy" Which is not enough to find the problem. Signed-off-by: Hu Keping --- signer/client/signer_trust.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/signer/client/signer_trust.go b/signer/client/signer_trust.go index a27297d7d7..a7d8e54880 100644 --- a/signer/client/signer_trust.go +++ b/signer/client/signer_trust.go @@ -185,11 +185,16 @@ func (trust *NotarySigner) CheckHealth(timeout time.Duration) error { status, err := trust.kmClient.CheckHealth(ctx, &pb.Void{}) defer cancel() if err == nil && len(status.Status) > 0 { - return fmt.Errorf("Trust is not healthy") - } else if err != nil && grpc.Code(err) == codes.DeadlineExceeded { - return fmt.Errorf( - "Timed out reaching trust service after %s.", timeout) + var stats string + for k, v := range status.Status { + stats += k + ":" + v + "; " + } + return fmt.Errorf("Trust is not healthy: %s", stats) } + if err != nil && grpc.Code(err) == codes.DeadlineExceeded { + return fmt.Errorf("Timed out reaching trust service after %s.", timeout) + } + return err }