// AddHealthCheckAt adds a health check at a subpath (http://<addr>:<port>/<plugin_id><path>)
431112
func (prod *SimpleProducer) AddHealthCheckAt(path string, callback thealthcheck.CallbackFunc) {
	thealthcheck.AddEndpoint("/"+prod.GetID()+path, callback)
}
657204
func (vm *DockerVM) HealthCheck(ctx context.Context) error {
	client, err := vm.getClientFnc()
	if err != nil {
		return errors.Wrap(err, "failed to connect to Docker daemon")
	}
	if err := client.PingWithContext(ctx); err != nil {
		return errors.Wrap(err, "failed to ping to Docker daemon")
	}
	return nil
}
751324
func (g *GSLB) SetPingHealthCheck() {
	g.Settings.GSLB.HealthCheck.Protocol = "ping"
	g.Settings.GSLB.HealthCheck.Host = ""
	g.Settings.GSLB.HealthCheck.Path = ""
	g.Settings.GSLB.HealthCheck.Status = ""
	g.Settings.GSLB.HealthCheck.Port = ""
}
639558
func (t *toolbox) AddHealthCheckFunc(desc string, fn HealthCheckFunc) {
	t.healthCheckJobs = append(t.healthCheckJobs, &healthCheck{
		desc:  desc,
		check: fn,
	})
}
291303
func (c *ZebedeeClient) Healthcheck() (string, error) {
	resp, err := c.client.Get(c.zebedeeURL + "/healthcheck")
	if err != nil {
		return "zebedee", err
	}

	if resp.StatusCode != http.StatusOK {
		return "zebedee", ErrInvalidZebedeeResponse{resp.StatusCode, "/healthcheck"}
	}

	return "", nil
}
1303964
func (c *Check) CheckHealth(ctx context.Context) Response {
	response := Response{
		Name:   "Health",
		Status: StatusPass,
		Checks: make(Responses, len(c.healthChecks)),
	}
	for i, ch := range c.healthChecks {
		resp := ch.Check(ctx)
		if resp.Status != StatusPass {
			response.Status = resp.Status
		}
		response.Checks[i] = resp
	}
	sort.Sort(response.Checks)
	return response
}
1130626
func (d *DockerDiscovery) HealthCheck(svc *service.Service) (string, string) {
	container, err := d.inspectContainer(svc)
	if err != nil {
		return "", ""
	}

	return container.Config.Labels["HealthCheck"], container.Config.Labels["HealthCheckArgs"]
}
901381
func (s *Listener) SetHealthCheck(v *HealthCheckPolicy) *Listener {
	s.HealthCheck = v
	return s
}
732401
func (agent *ActionAgent) initHealthCheck() {
	registerReplicationReporter(agent)
	registerHeartbeatReporter(agent.QueryServiceControl)

	log.Infof("Starting periodic health check every %v", *healthCheckInterval)
	t := timer.NewTimer(*healthCheckInterval)
	servenv.OnTermSync(func() {
		// When we enter lameduck mode, we want to not call
		// the health check any more. After this returns, we
		// are guaranteed to not call it.
		log.Info("Stopping periodic health check timer")
		t.Stop()

		// Now we can finish up and force ourselves to not healthy.
		agent.terminateHealthChecks()
	})
	t.Start(func() {
		agent.runHealthCheck()
	})
	t.Trigger()
}
612520
func (a *Agent) AddCheck(check *structs.HealthCheck, chkType *structs.CheckType, persist bool, token string, source configSource) error {
	a.stateLock.Lock()
	defer a.stateLock.Unlock()
	return a.addCheckLocked(check, chkType, persist, token, source)
}
938950
func (c *Client) HealthHealth(ctx context.Context, path string) (*http.Response, error) {
	req, err := c.NewHealthHealthRequest(ctx, path)
	if err != nil {
		return nil, err
	}
	return c.Client.Do(ctx, req)
}
1300120
func (h *Health) AddChecks(cfgs []*Config) error {
	if h.active.val() {
		return ErrNoAddCfgWhenActive
	}

	h.configs = append(h.configs, cfgs...)

	return nil
}
422426
func (hc *HealthCheckImpl) AddTablet(tablet *topodatapb.Tablet, name string) {
	ctx, cancelFunc := context.WithCancel(context.Background())
	key := TabletToMapKey(tablet)
	hcc := &healthCheckConn{
		ctx: ctx,
		tabletStats: TabletStats{
			Key:    key,
			Tablet: tablet,
			Name:   name,
			Target: &querypb.Target{},
			Up:     true,
		},
	}
	hc.mu.Lock()
	if hc.addrToHealth == nil {
		// already closed.
		hc.mu.Unlock()
		return
	}
	if _, ok := hc.addrToHealth[key]; ok {
		hc.mu.Unlock()
		log.Warningf("adding duplicate tablet %v for %v: %+v", name, tablet.Alias.Cell, tablet)
		return
	}
	hc.addrToHealth[key] = &tabletHealth{
		cancelFunc:        cancelFunc,
		latestTabletStats: hcc.tabletStats,
	}
	hc.initialUpdatesWG.Add(1)
	hc.connsWG.Add(1)
	hc.mu.Unlock()

	go hc.checkConn(hcc, name)
}
298989
func HealthCheck() http.Handler {
	r := mux.NewRouter()
	r.HandleFunc("/health", func(w http.ResponseWriter, req *http.Request) {
		w.Write([]byte("Healthy!\n"))
	})
	return r
}
1085135
func (t *toolbox) AddHealthCheck(hc HealthChecker) {
	t.healthCheckJobs = append(t.healthCheckJobs, &healthCheck{
		HealthChecker: hc,
	})
}
239949
func (s *LoadBalancer) SetHealthCheckPath(v string) *LoadBalancer {
	s.HealthCheckPath = &v
	return s
}
708294
func NewHealthChecksMW(basePath string) alice.Constructor {
	return func(next http.Handler) http.Handler {
		return NewHealthChecks(basePath, next)
	}
}