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:
1 parent
31044b2b64
commit
3b31b16796
31 files changed
+7706
-61
No files matched your search
+55
-1
@@ -542,6 +542,10 @@ export interface HealthCheckSettings {
|
||||
/** The monthly report: last month's availability, incidents, updates and renewals, in one message on a day of the month. */
|
||||
export interface MonthlyReportSettings {
|
||||
enabled: boolean;
|
||||
/** Also send the quarter's report after the month that ends it. */
|
||||
quarterly: boolean;
|
||||
/** Also send the year's report after December. */
|
||||
annual: boolean;
|
||||
/** Day of the month, 1–28, in the notification time zone. */
|
||||
day: number;
|
||||
/** "HH:MM", in the notification time zone. */
|
||||
@@ -1101,9 +1105,52 @@ export interface AvailabilityRow {
|
||||
percent: number | null;
|
||||
downMinutes: number;
|
||||
}
|
||||
export type ServiceLevelSubject = "endpoint" | "server" | "integration";
|
||||
|
||||
/** How one service-level target did over a stretch (a month, quarter or year) in a report. */
|
||||
export interface ServiceLevelResult {
|
||||
id: number;
|
||||
name: string;
|
||||
subjectType: ServiceLevelSubject;
|
||||
target: number;
|
||||
percent: number | null;
|
||||
downMinutes: number;
|
||||
allowedMinutes: number;
|
||||
usedPercent: number | null;
|
||||
met: boolean | null;
|
||||
}
|
||||
|
||||
/** A service-level target, where this month's error budget stands, and how the months before it went. */
|
||||
export interface ServiceLevel {
|
||||
id: number;
|
||||
name: string;
|
||||
subjectType: ServiceLevelSubject;
|
||||
subjectId: number;
|
||||
/** The thing measured; null when it has been removed. */
|
||||
subjectName: string | null;
|
||||
target: number;
|
||||
alert: boolean;
|
||||
createdBy: string | null;
|
||||
period: { id: string; label: string; from: string; to: string; totalMinutes: number; elapsedMinutes: number };
|
||||
measure: { percent: number | null; downMinutes: number; knownMinutes: number };
|
||||
budget: { allowedMinutes: number; usedPercent: number | null; remainingMinutes: number; state: "ok" | "at_risk" | "breached" | "no_data"; projectedPercent: number | null };
|
||||
history: { id: string; label: string; percent: number | null; downMinutes: number; allowedMinutes: number; met: boolean | null }[];
|
||||
}
|
||||
|
||||
export interface ServiceLevelInput {
|
||||
name: string;
|
||||
subjectType: ServiceLevelSubject;
|
||||
subjectId: number;
|
||||
target: number;
|
||||
alert: boolean;
|
||||
}
|
||||
|
||||
export interface MonthlyReport {
|
||||
/** A month ("2026-09"), a quarter ("2026-Q3") or a year ("2026"). */
|
||||
period: "month" | "quarter" | "year";
|
||||
month: string;
|
||||
label: string;
|
||||
serviceLevels: ServiceLevelResult[];
|
||||
from: string;
|
||||
to: string;
|
||||
partial: boolean;
|
||||
@@ -2510,6 +2557,12 @@ export const api = {
|
||||
create: (label: string) => request<{ token: MetricsToken; secret: string }>("/api/metrics-tokens", { method: "POST", body: JSON.stringify({ label }) }),
|
||||
remove: (id: number) => request<void>(`/api/metrics-tokens/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
serviceLevels: {
|
||||
list: () => request<{ levels: ServiceLevel[]; subjects: Record<ServiceLevelSubject, { id: number; name: string }[]> }>("/api/service-levels"),
|
||||
create: (data: ServiceLevelInput) => request<{ id: number }>("/api/service-levels", { method: "POST", body: JSON.stringify(data) }),
|
||||
update: (id: number, data: ServiceLevelInput) => request<{ ok: boolean }>(`/api/service-levels/${id}`, { method: "PUT", body: JSON.stringify(data) }),
|
||||
remove: (id: number) => request<void>(`/api/service-levels/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
ups: {
|
||||
list: () => request<{ ups: UpsInfo[] }>("/api/ups"),
|
||||
history: (id: number, days: number) => request<UpsHistory>(`/api/ups/${id}/history?days=${days}`),
|
||||
@@ -2545,7 +2598,8 @@ export const api = {
|
||||
cancel: (runId: number) => request<{ run: PatchPlanRun }>(`/api/patch-plans/runs/${runId}/cancel`, { method: "POST" }),
|
||||
},
|
||||
reports: {
|
||||
monthly: (month?: string) => request<{ report: MonthlyReport; months: { id: string; label: string }[] }>(`/api/reports/monthly${month ? `?month=${month}` : ""}`),
|
||||
monthly: (month?: string) =>
|
||||
request<{ report: MonthlyReport; months: { id: string; label: string }[]; quarters: { id: string; label: string }[]; years: { id: string; label: string }[] }>(`/api/reports/monthly${month ? `?month=${month}` : ""}`),
|
||||
monthlyText: (month?: string) => request<{ title: string; message: string }>(`/api/reports/monthly?format=text${month ? `&month=${month}` : ""}`),
|
||||
sendMonthly: (month?: string) => request<{ sent: boolean }>("/api/reports/monthly/send", { method: "POST", body: JSON.stringify({ month }) }),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user