Service-level targets with error budgets, and quarterly and annual reports

Monitoring -> Service levels: a target (99.9 %) on an endpoint check, a server or an
integration, measured over calendar months. Shows the figure, downtime used, the
error budget left, and how the last six months went. 80 % of the budget used is a
warning and an overspent budget a critical alert. Endpoints are measured day by day,
servers and integrations to the minute from the audit log.

The report page gains Quarter and Year (same figures, with a Service levels section),
and two settings send the quarterly and annual report after the month that ends them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-21 22:20:07 +02:00
1 parent 31044b2b64
commit 3b31b16796
31 files changed
+7706 -61

No files matched your search

+17
View File
@@ -1159,6 +1159,23 @@ export const haReadings = sqliteTable(
(t) => [index("ha_readings_lookup_idx").on(t.integrationId, t.entityId, t.at)],
);
// ─── Service-level targets ──────────────────────────────────────────────────
// "99.9 % for Gitea": a target on an endpoint check, a server or an integration, measured over calendar months (services/serviceLevels.ts). The thing measured is a
// plain reference (type and id), not a foreign key: one whose subject is removed is shown as having nothing to measure.
export const serviceLevels = sqliteTable("service_levels", {
id: integer("id").primaryKey({ autoIncrement: true }),
name: text("name").notNull(),
subjectType: text("subject_type").notNull(), // endpoint | server | integration
subjectId: integer("subject_id").notNull(),
target: real("target").notNull(), // percent, 90–99.999
alert: integer("alert", { mode: "boolean" }).notNull().default(true), // warn when most of the month's error budget is used, and when it is overspent
createdBy: text("created_by"),
createdAt: text("created_at")
.notNull()
.default(sql`(current_timestamp)`),
});
// ─── UPS ────────────────────────────────────────────────────────────────────
// How a UPS (an integration of type "ups", read over NUT or SNMP by services/upsSync.ts) is right now: one row each, replaced at every read. `updatedAt` is the last