Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
LateAfter time.Duration // Late window duration after check interval.
CheckInterval time.Duration // Polling interval for checks.
AlertOnRecovery bool // Whether to emit recovery alerts.
AlertOnLate bool // Whether to emit late alerts.
}
Config controls the runner timing and alert behavior.
type HeartbeatType ¶
type HeartbeatType int
HeartbeatType represents a heartbeat event.
const HeartbeatReceive HeartbeatType = iota // HeartbeatReceive represents a received heartbeat.
type Sender ¶
type Sender interface {
Late(now time.Time, since time.Duration, payload string)
Missing(now time.Time, since time.Duration, payload string)
Recovered(now time.Time, payload string)
Transition(now time.Time, from Stage, to Stage, since time.Duration)
}
Sender delivers alerts for runner state transitions.
type Snapshot ¶
type Snapshot struct {
LastSeen time.Time // Timestamp of last heartbeat.
LastPayload string // Body of last heartbeat payload.
Stage Stage // Current stage.
}
Snapshot captures a consistent view of State.
type Stage ¶
type Stage int
Stage represents the heartbeat state relative to thresholds.
const ( // StageNever indicates the heartbeat is never seen. StageNever Stage = iota // StageOK indicates the heartbeat is within thresholds. StageOK // StageLate indicates the heartbeat is beyond the late threshold. StageLate // StageMissing indicates the heartbeat is beyond the missing threshold. StageMissing )
type State ¶
type State struct {
// contains filtered or unexported fields
}
State stores the last seen heartbeat and alert metadata.
func (*State) Mailbox ¶
func (s *State) Mailbox() <-chan HeartbeatType
Mailbox returns the heartbeat event channel.
func (*State) MarkMissing ¶
MarkMissing updates the state to missing and records the alert time.
Click to show internal directories.
Click to hide internal directories.