INNER CODE UNIT · Go
func
m3db/m3 · scripts/development/m3_consumer_service/bootstrap/main.go:177
func (c *coordinatorClient) HealthCheck(ctx context.Context) error {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.BaseURL+"/health", nil)
if err != nil {
return err
}
resp, err := c.HTTP.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
b, _ := io.ReadAll(resp.Body)
return fmt.Errorf("healthcheck failed: status=%d body=%s", resp.StatusCode, string(b))
}
io.Copy(io.Discard, resp.Body)
return nil
}