Skip to content

Commit

Permalink
Merge pull request #8726 from amenzhinsky/grpc-hc-error
Browse files Browse the repository at this point in the history
Return grpc serving status in health check errors
  • Loading branch information
dnephin committed Sep 25, 2020
2 parents 5931df1 + edac9f9 commit 6200325
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/8726.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
checks: add health status to the failure message when gRPC healthchecks fail.
```
6 changes: 2 additions & 4 deletions agent/checks/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6200325

Please sign in to comment.