mirror of https://github.com/docker/docs.git
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 <hukeping@huawei.com>
This commit is contained in:
parent
af40d720c0
commit
837f659e85
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue