Notification routing rules, per-browser push wishes, escalation of unacknowledged alerts
- Routing: rules pick channels by kind, severity and server tags (first match wins, none = nobody); mixed batches split per route; recoveries follow their alert; quiet-hours digest keeps each notification's audience - Push: each subscribed browser can ask for a minimum severity and some kinds - Escalation: up to three timed steps re-notify alerts nobody has acknowledged, through chosen channels and an optional extra email; an acknowledgement stops them - Fix ntfy: titles with an em dash made every ntfy send fail (header not Latin-1); now RFC 2047 encoded Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9caa414829
commit
43fc5e0272
21 files changed
+4769
-55
No files matched your search
@@ -64,6 +64,8 @@ export const notificationQueue = sqliteTable("notification_queue", {
|
||||
id: integer("id").primaryKey({ autoIncrement: true }),
|
||||
title: text("title").notNull(),
|
||||
message: text("message").notNull(),
|
||||
/** JSON: who it is for (the channels and browsers a routing rule picked); null = everyone, as before routing existed. */
|
||||
audience: text("audience"),
|
||||
createdAt: text("created_at")
|
||||
.notNull()
|
||||
.default(sql`(current_timestamp)`),
|
||||
@@ -119,6 +121,10 @@ export const pushSubscriptions = sqliteTable("push_subscriptions", {
|
||||
.notNull()
|
||||
.default(sql`(current_timestamp)`),
|
||||
lastSuccessAt: text("last_success_at"),
|
||||
/** This browser only wants alerts at least this bad ("warning" or "critical"); null = every severity. */
|
||||
minSeverity: text("min_severity"),
|
||||
/** JSON string[] of the kinds of alert it wants; null = every kind. */
|
||||
categories: text("categories"),
|
||||
});
|
||||
|
||||
// "A needs B", for things that can be down: a server or an integration each. Polymorphic like maintenance_windows (no foreign key); an edge whose
|
||||
@@ -678,6 +684,8 @@ export const alertIncidents = sqliteTable(
|
||||
resolvedAt: text("resolved_at"), // ISO; null while it is open
|
||||
lastSeenAt: text("last_seen_at").notNull(), // ISO
|
||||
missingSince: text("missing_since"), // ISO; set while it has been absent from the last look(s), before it is called over
|
||||
escalatedStep: integer("escalated_step").notNull().default(0), // the highest escalation step already sent for this incident (0 = none)
|
||||
escalatedAt: text("escalated_at"), // ISO; when that was
|
||||
},
|
||||
(t) => [index("alert_incidents_key_idx").on(t.alertKey), index("alert_incidents_opened_idx").on(t.openedAt), index("alert_incidents_target_idx").on(t.targetType, t.targetId)],
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user