Documentation
¶
Overview ¶
Package alert is Mooring's read-and-notify alert engine (plan §8): ONE evaluator that reads the poller's snapshot (zero network I/O, zero docker writes, side-effect-free) and drives a per-(rule,target) state machine, and a SEPARATE rate-limited notifier that drains an outbox. It defers to an app that already alerts — with a down-only safety net so a dark app still pages on liveness.
Index ¶
Constants ¶
const ( LevelWarning = "warning" LevelCritical = "critical" )
Levels.
const ( KindContainerDown = "container_down" KindHostCPU = "host_cpu" KindHostMem = "host_mem" KindHostDisk = "host_disk" KindDepDown = "dep_down" KindRestartStorm = "restart_storm" )
Kinds (the read-detectable v1 set; the §8.4 infra taxonomy extends this engine).
Variables ¶
This section is empty.
Functions ¶
func Evaluate ¶
Evaluate runs every enabled rule against the snapshot and the prior state, returning the new states and any outbox notifications to enqueue. It is PURE (no I/O); the caller persists + signals the notifier. now is unix seconds.
func SortStates ¶
func SortStates(s []State)
SortStates orders states deterministically (rule, then target).
func ValidChannelKind ¶
ValidChannelKind reports whether kind is supported.
Types ¶
type Channel ¶
type Channel interface {
Send(ctx context.Context, n Notification) error
}
Channel delivers a Notification. Implementations use std-lib only.
type Notification ¶
Notification is the rendered alert handed to a channel. Title/Body are plain-text with minimal markdown — there is no template engine (plan §8: never one that could execute code).
type Outbox ¶
type Outbox struct {
RuleID int64
Target string
Kind string
Level string
Transition string // firing | resolved
Summary string
DedupeKey string
}
Outbox is one notification handoff the evaluator appends (it never sends).