mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
Merge pull request #8726 from amenzhinsky/grpc-hc-error
Return grpc serving status in health check errors
This commit is contained in:
commit
6200325e3b
3
.changelog/8726.txt
Normal file
3
.changelog/8726.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
```release-note:improvement
|
||||||
|
checks: add health status to the failure message when gRPC healthchecks fail.
|
||||||
|
```
|
@ -13,8 +13,6 @@ import (
|
|||||||
"google.golang.org/grpc/resolver"
|
"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.
|
// GrpcHealthProbe connects to gRPC application and queries health service for application/service status.
|
||||||
type GrpcHealthProbe struct {
|
type GrpcHealthProbe struct {
|
||||||
server string
|
server string
|
||||||
@ -69,8 +67,8 @@ func (probe *GrpcHealthProbe) Check(target string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if response == nil || response.Status != hv1.HealthCheckResponse_SERVING {
|
if response.Status != hv1.HealthCheckResponse_SERVING {
|
||||||
return ErrGRPCUnhealthy
|
return fmt.Errorf("gRPC %s serving status: %s", target, response.Status)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user