Threshold Alerts
What this is for
Threshold Alerts (/spine-framework/admin/observability/alerts) is the admin UI for alert rules over platform metrics, stored as items records of type threshold_alert through the generic admin-data API. Threshold alerting is not implemented end-to-end: system-cron's per-tick evaluator was removed (it read a threshold_alerts table no migration ever created — not the items records this page writes), no threshold_alert type is seeded, and nothing emits threshold.breached events. logs.ts still maps that event name into the alert display shape. This page documents the vestigial surface (decision spine-framework:0016).
Why it exists
None today — this page exists so the table's status is documented rather than rediscovered.
What exists instead:
logs.tsmapslogsrows into alert-shaped responses (metric,threshold_value,actual_value) for the admin UI — alert display is synthesized, not stored.system-cron.tspreviously readthreshold_alerts— a table no migration defines (archive-lineage residue; theadminDbcall silently failed every tick). That dead path has been removed; threshold alerting is unimplemented end-to-end.
Why it would exist (the intent): threshold alerting needs declared rules (metric + threshold + pipeline to fire) — presumably what alerts/threshold_alerts were meant to be.
Fields and settings
- Title / Description — record
titleanddescriptionshown in the list. - Status —
activeorinactive; toggled per-row (writes bothstatusanddata.is_active). - Metric (
data.metric) —error_rate(%),latency_p95(ms), orpipeline_failure_rate(%). - Operator (
data.operator) —gt(>) orlt(<). - Value (
data.value) — the threshold number, in the metric's unit. - Window (
data.window_minutes) — lookback window the metric is computed over. - Pipeline (
data.pipeline_id) — optional pipeline invoked when the threshold is breached; populated from/api/pipelines?action=list. - Stats cards — Total, Active, Inactive, With Pipeline.
Downstream effects
- Alerts are plain
itemsrecords — create/edit/delete goes through/api/admin-data?entity=itemswithtype_id: "threshold_alert", so they inherit the type'srecord_permissionsand validation. - No
threshold_alerttype is seeded: the list returns empty (Type not found→[]) and create fails until someone creates the type (e.g. via the Types admin). The records then save — but nothing evaluates them. system-crondoes not evaluate alerts. The removed evaluator queriedpublic.threshold_alerts(a table that never existed), not theseitemsrows — so even before removal, alerts saved here were never evaluated.- Deleting an alert removes the record; there is no history table beyond
logs.
Minimal configuration
Title: High error rate
data.metric: error_rate · data.operator: gt · data.value: 5
data.window_minutes: 60 · is_active: trueFull configuration
{
"type_id": "threshold_alert",
"title": "P95 latency above 2s",
"description": "Page on sustained slow requests",
"status": "active",
"data": {
"metric": "latency_p95",
"operator": "gt",
"value": 2000,
"window_minutes": 30,
"pipeline_id": "<pipeline uuid>",
"is_active": true
}
}Example
A platform team wants error_rate > 5% / 60min to fire an on-call pipeline. Today they can only model the rule — the record saves, but no evaluator exists to breach it. To build real threshold alerting, the work is an evaluator (a system-cron stage or a dedicated function) that reads threshold_alert items, computes the metrics in observability.ts, and emits threshold.breached + invokes data.pipeline_id.
Core files
.framework/src/pages/admin/AlertsConfigPage.tsx— this page (modal create/edit, toggle, delete).framework/functions/admin-data.ts— CRUD backend (entity=items,type_id=threshold_alert).framework/functions/system-cron.ts— tick driver; the removedevaluateThresholdslived here (deadthreshold_alertsquery, removed in3b5a7de).framework/functions/observability.ts—error_rate/latency_percentiles/pipeline_statsmetrics an evaluator would compare against.framework/functions/logs.ts— mapsthreshold.breachedlog rows into the alert display shape (listAccount,event=threshold.breached)- Table:
public.itemsrows of typethreshold_alert(the type itself is not seeded)
Agent notes
- The type slug is
threshold_alertand the config lives underdata.*— do not confuse it with thepipelines/triggersconfig tables. statusanddata.is_activeare written together by the toggle; editing the record elsewhere can desync them — and there is currently no reader of either field.- Nothing emits
threshold.breached; the Logs filter for it exists but always returns empty until an evaluator is built. - Decision
spine-framework:0016recordspublic.alertsandthreshold_alertsas vestigial — when a real implementation is commissioned, define the rule table properly rather than reusingalerts.