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)
| 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. |
| 145 | func (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. |
| 153 | func (i *InstanceDesc) IsReady(storageLastUpdated time.Time, heartbeatTimeout time.Duration) error { |