// ReportHealthStatus sends an update to the health check status cache.
355902
func (s *Server) ReportHealthStatus(request HealthStatusRequest, _ *struct{}) error {
	s.f.ReportHealthStatus(request.Key, request.Value, request.Expires)
	return nil
}
8898
func (g *Cloud) UpdateAlphaHealthCheck(hc *computealpha.HealthCheck) error {
	ctx, cancel := cloud.ContextWithCallTimeout()
	defer cancel()

	mc := newHealthcheckMetricContextWithVersion("update", computeAlphaVersion)
	return mc.Observe(g.c.AlphaHealthChecks().Update(ctx, meta.GlobalKey(hc.Name), hc))
}
13284
func NewSlaveHealthChecker(slaveUPID *upid.UPID, threshold int, checkDuration time.Duration, timeout time.Duration) *SlaveHealthChecker {
	tr := &http.Transport{}
	checker := &SlaveHealthChecker{
		slaveUPID:     slaveUPID,
		client:        &http.Client{Timeout: timeout, Transport: tr},
		threshold:     int32(threshold),
		checkDuration: checkDuration,
		stop:          make(chan struct{}),
		ch:            make(chan time.Time, 1),
		tr:            tr,
	}
	if timeout == 0 {
		checker.client.Timeout = defaultTimeout
	}
	if checkDuration == 0 {
		checker.checkDuration = defaultCheckDuration
	}
	if threshold <= 0 {
		checker.threshold = defaultThreshold
	}
	return checker
}
825367
func (fhc *FakeHealthCheck) CacheStatus() TabletsCacheStatusList {
	fhc.mu.Lock()
	defer fhc.mu.Unlock()

	stats := make(TabletsCacheStatusList, 0, len(fhc.items))
	for _, item := range fhc.items {
		stats = append(stats, &TabletsCacheStatus{
			Cell:         "FakeCell",
			Target:       item.ts.Target,
			TabletsStats: TabletStatsList{item.ts},
		})
	}
	sort.Sort(stats)
	return stats
}
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
}
321889
func NewStatus(body []interface{}) (s Status) {
	s.LastCheckedTime = body[0].(int64)
	s.Progress = body[1].(float64)
	s.CurrentOperation = body[2].(string)
	s.NewVersion = body[3].(string)
	s.NewSize = body[4].(int64)

	return
}
1093820
func (hc *HealthCheckImpl) CacheStatus() TabletsCacheStatusList {
	tcsMap := hc.cacheStatusMap()
	tcsl := make(TabletsCacheStatusList, 0, len(tcsMap))
	for _, tcs := range tcsMap {
		tcsl = append(tcsl, tcs)
	}
	sort.Sort(tcsl)
	return tcsl
}
174600
func (s *Task) SetHealthStatus(v string) *Task {
	s.HealthStatus = &v
	return s
}
891755
func (_m *FacadeInterface) ReportHealthStatus(key health.HealthStatusKey, value health.HealthStatus, expires time.Duration) {
	_m.Called(key, value, expires)
}
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
}
717235
func (a *LBClient) ReportHealthStatus(req master.HealthStatusRequest, unused *int) error {
	glog.V(4).Infof("ControlCenterAgent.ReportHealthStatus()")
	return a.rpcClient.Call("ControlCenterAgent.ReportHealthStatus", req, unused, 0)
}
395953
func (c *Client) GetHealthCheck(i *GetHealthCheckInput) (*HealthCheck, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	if i.Name == "" {
		return nil, ErrMissingName
	}

	path := fmt.Sprintf("/service/%s/version/%d/healthcheck/%s", i.Service, i.Version, i.Name)
	resp, err := c.Get(path, nil)
	if err != nil {
		return nil, err
	}

	var h *HealthCheck
	if err := decodeJSON(&h, resp.Body); err != nil {
		return nil, err
	}
	return h, nil
}
1295125
func (api *SimpleMonitorAPI) Health(id int64) (*sacloud.SimpleMonitorHealthCheckStatus, error) {
	var (
		method = "GET"
		uri    = fmt.Sprintf("%s/%d/health", api.getResourceURL(), id)
	)
	res := struct {
		SimpleMonitor *sacloud.SimpleMonitorHealthCheckStatus `json:",omitempty"`
	}{}

	err := api.baseAPI.request(method, uri, nil, &res)
	if err != nil {
		return nil, err
	}
	return res.SimpleMonitor, nil
}
1333922
func (di *DriverInfo) MergeHealthCheck(other *DriverInfo) {
	di.Healthy = other.Healthy
	di.HealthDescription = other.HealthDescription
	di.UpdateTime = other.UpdateTime
}
175839
func (c *Check) CheckHealth(ctx context.Context) Response {
	response := Response{
		Name:   "Health",
		Status: StatusPass,
		Checks: make(Responses, len(c.healthChecks)),
	}
	override := c.manualOverride.Load().(bool)
	if override {
		if c.manualHealthState.Load().(bool) {
			response.Status = StatusPass
		} else {
			response.Status = StatusFail
		}
		overrideResponse := Response{
			Name:    "manual-override",
			Message: "health manually overridden",
		}
		response.Checks = append(response.Checks, overrideResponse)
	}
	for i, ch := range c.healthChecks {
		resp := ch.Check(ctx)
		if resp.Status != StatusPass && !override {
			response.Status = resp.Status
		}
		response.Checks[i] = resp
	}
	sort.Sort(response.Checks)
	return response
}
801698
func (c *Client) GetServicesHealth() (map[string]map[int]map[string]health.HealthStatus, error) {
	results := make(map[string]map[int]map[string]health.HealthStatus)
	err := c.call("GetServicesHealth", empty, &results)
	return results, err
}
292656
func (h *Handler) healthStatus() status.Status {
	info, err := h.Process.Info()
	if err != nil || !info.Running {
		return status.Unhealthy
	}
	return status.Healthy
}