Documentation
¶
Overview ¶
Package gatealert is the alert engine of the publication gate's aggregate conditions (ADR-0064 part D5b, "Alerts", R1-L2): when to page, when to recover, and the text.
Contract ¶
- One page on entering a condition, with the node count; no re-page while it stays present or flaps.
- Recovery only after the condition has stayed clear for ClearFor; a reappearance restarts that period.
- A page is latched only when it is deliverable (an enabled webhook subscribes to its event). An undeliverable page is not spent: the condition stays unpaged and the next evaluation tries again. A condition that clears unpaged sends no recovery.
- Paged now: not ancestry and contradiction, the two conditions that mean something on an unarmed gate. The armed-gate conditions land with arming, on this engine.
Boundary ¶
A leaf: standard library only, no package state, no init, no goroutine, no clock of its own (the time is passed in). The application owns the report table and the freshness window that produce the counts, when evaluations run, which events have subscribers, and dispatch.
Index ¶
Constants ¶
const ( EventNotAncestry = "publication_gate_not_ancestry" EventContradiction = "publication_gate_contradiction" EventRecovered = "publication_gate_recovered" )
Events.
const ClearFor = 10 * time.Minute
ClearFor is how long a condition must stay clear before its recovery is paged.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine holds the conditions' alert states. The zero value is ready; it is safe for concurrent use.
func (*Engine) Active ¶
Active reports whether event's condition has been paged and not yet recovered (false for an event this engine does not page).
type Hysteresis ¶
type Hysteresis struct {
// contains filtered or unexported fields
}
Hysteresis is one aggregate condition's alert state.
func (*Hysteresis) Active ¶
func (h *Hysteresis) Active() bool
Active reports whether the condition has been paged and not yet recovered.
func (*Hysteresis) Step ¶
func (h *Hysteresis) Step(present, deliverable bool, now time.Time, clearFor time.Duration) (page, recovered bool)
Step folds whether the condition is present at now. It pages on entering the condition when the page is deliverable (otherwise the condition stays unpaged and the next step tries again) and recovers only once it has stayed clear for clearFor.