feat(alert): suppress offline + add staleness alert for intermittent hosts
This commit is contained in:
@@ -122,6 +122,16 @@ func alertPayload(ctx context.Context, st *store.Store, ev notification.Event, a
|
||||
}
|
||||
}
|
||||
|
||||
// ResolveOnModeChange clears any open agent_offline and stale_schedule
|
||||
// alerts for a host whose always-on flag was just toggled. The next
|
||||
// 60s tick re-raises whichever still applies under the new mode, so
|
||||
// this is a self-correcting "wipe and let the sweep settle" call.
|
||||
// Safe to invoke from the HTTP layer (it only touches the store + hub).
|
||||
func (e *Engine) ResolveOnModeChange(ctx context.Context, hostID string, when time.Time) {
|
||||
e.resolveAndNotify(ctx, hostID, KindAgentOffline, "", when)
|
||||
e.resolveAndNotify(ctx, hostID, KindStaleSchedule, "", when)
|
||||
}
|
||||
|
||||
// resolveAndNotify clears the open (or acknowledged) alert matching
|
||||
// (host_id, kind, dedup_key) via store.AutoResolve, then fires
|
||||
// alert.resolved for the row(s) actually closed. Best-effort —
|
||||
|
||||
Reference in New Issue
Block a user