Monitorex.AlertHistory
(monitorex v0.6.0)
Copy Markdown
GenServer that manages an append-only ETS log of fired alerts.
Provides query, acknowledge, snooze, and active-alert-count functions used by the dashboard UI and the alert evaluation engine.
Summary
Functions
Acknowledge an alert by its timestamp key.
Returns a specification to start this module under a supervisor.
Re-evaluate snoozed alerts: any whose snooze has expired become :firing again.
Called automatically by the AlertHistory cleanup cycle.
Count of currently firing (unacknowledged, non-snoozed) alerts.
List alert history entries, newest first.
Record a fired alert into the history table.
Snooze an alert by its timestamp key.
Start the AlertHistory GenServer.
Clear old entries beyond :max_alert_history (default 1_000).
Functions
@spec acknowledge(integer()) :: :ok | :not_found
Acknowledge an alert by its timestamp key.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec expire_snoozes() :: :ok
Re-evaluate snoozed alerts: any whose snooze has expired become :firing again.
Called automatically by the AlertHistory cleanup cycle.
@spec firing_count() :: non_neg_integer()
Count of currently firing (unacknowledged, non-snoozed) alerts.
List alert history entries, newest first.
Options
:limit— max entries (default: 100):status— filter by:firing,:acknowledged,:snoozed, or:all:metric— filter by metric atom
@spec record_alert(map()) :: :ok
Record a fired alert into the history table.
@spec snooze(integer(), snooze_seconds :: pos_integer()) :: :ok | :not_found
Snooze an alert by its timestamp key.
Start the AlertHistory GenServer.
@spec trim() :: :ok
Clear old entries beyond :max_alert_history (default 1_000).