MCPcopy Create free account
hub / github.com/cortexproject/cortex / healthCheck

Function healthCheck

pkg/ring/client/pool.go:192–205  ·  view source on GitHub ↗

healthCheck will check if the client is still healthy, returning an error if it is not

(client PoolClient, timeout time.Duration)

Source from the content-addressed store, hash-verified

190
191// healthCheck will check if the client is still healthy, returning an error if it is not
192func healthCheck(client PoolClient, timeout time.Duration) error {
193 ctx, cancel := context.WithTimeout(context.Background(), timeout)
194 defer cancel()
195 ctx = user.InjectOrgID(ctx, "0")
196
197 resp, err := client.Check(ctx, &grpc_health_v1.HealthCheckRequest{})
198 if err != nil {
199 return err
200 }
201 if resp.Status != grpc_health_v1.HealthCheckResponse_SERVING {
202 return fmt.Errorf("failing healthcheck status: %s", resp.Status)
203 }
204 return nil
205}

Callers 2

cleanUnhealthyMethod · 0.70
TestHealthCheckFunction · 0.70

Calls 1

CheckMethod · 0.45

Tested by 1

TestHealthCheckFunction · 0.56