Flapping alerts, a noise report and bulk actions with undo
Flapping: an alert raised three times within an hour is announced once as flapping, its further raise/clear messages are held until it has been calm for an hour, and one message then says whether it is still active. Event webhooks still hear everything. The state survives restarts. Alerts > Noise lists the alerts that keep coming back (7-180 days): how often, how long, most in an hour, and a hint on what helps. Bulk actions on Alerts (acknowledge, remove acknowledgement, silence), Servers (tag, silence, runs on) and Inventory (location and dates, print labels). Each reports what it left alone and why, and has an Undo on the toast. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
be6c5552bd
commit
73a06ebe63
35 files changed
+2546
-17
No files matched your search
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Every few minutes: flapping alerts that have been quiet for an hour have settled — say so once, with the state each is in now (see services/flapGuard.ts).
|
||||
*/
|
||||
import { getAlerts } from "./alerts.js";
|
||||
import { keyOfAlertId, settleFlaps } from "./flapGuard.js";
|
||||
import { notifySettled } from "./notify.js";
|
||||
|
||||
/** One look: returns how many settled. */
|
||||
export async function settleFlappingAlerts(now: Date = new Date()): Promise<number> {
|
||||
const report = await getAlerts(false);
|
||||
const active = new Set(report.alerts.map((a) => keyOfAlertId(a.id, a.category)));
|
||||
const settled = await settleFlaps(active, now);
|
||||
if (settled.length > 0) await notifySettled(settled);
|
||||
return settled.length;
|
||||
}
|
||||
|
||||
let timer: ReturnType<typeof setInterval> | null = null;
|
||||
|
||||
export function initFlapMonitor(): void {
|
||||
if (timer) return;
|
||||
timer = setInterval(() => void settleFlappingAlerts().catch((err) => console.error("[flap] couldn't look at the flapping alerts:", err)), 5 * 60_000);
|
||||
timer.unref();
|
||||
}
|
||||
Reference in new issue
Block a user