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

Method IsHeartbeatHealthy

pkg/ring/model.go:145–150  ·  view source on GitHub ↗

IsHeartbeatHealthy returns whether the heartbeat timestamp for the ingester is within the specified timeout period. A timeout of zero disables the timeout; the heartbeat is ignored.

(heartbeatTimeout time.Duration, storageLastUpdated time.Time)

Source from the content-addressed store, hash-verified

143// IsHeartbeatHealthy returns whether the heartbeat timestamp for the ingester is within the
144// specified timeout period. A timeout of zero disables the timeout; the heartbeat is ignored.
145func (i *InstanceDesc) IsHeartbeatHealthy(heartbeatTimeout time.Duration, storageLastUpdated time.Time) bool {
146 if heartbeatTimeout == 0 {
147 return true
148 }
149 return storageLastUpdated.Sub(time.Unix(i.Timestamp, 0)) <= heartbeatTimeout
150}
151
152// IsReady returns no error if the instance is ACTIVE and healthy.
153func (i *InstanceDesc) IsReady(storageLastUpdated time.Time, heartbeatTimeout time.Duration) error {

Callers 2

IsHealthyMethod · 0.95
IsReadyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected