Alarms and actions
PartialAn alarm is a raised problem on a component, held from the moment it is raised until it clears. An event rule raises and clears alarms on its own as samples land; a severity level says how bad an alarm is and what it does to its component’s health; an action rule decides when a notification about an alarm is sent, and to which targets. Detection and response are kept apart: a rule that detects never contains its response.
To operate these, see rules and notifications for the admin, and alarms and notifications for the operator.
The alarm (a stateful entity)
Section titled “The alarm (a stateful entity)”An alarm is a morning alarm, not a pop-up: it goes off and stays raised until something clears it.
The alarm row holds its state directly rather than being rebuilt from a log: a severity (a
severity level by name), a message, raised_at and a nullable
cleared_at. Clearing sets cleared_at and keeps the row; clearing an alarm already cleared is an
explicit miss, not a silent success.
An alarm is raised by a caller (an operator or an API client, on a component) or by an
event rule. Its identity is (component, dedup_key)
(ADR-0075):
at most one alarm per identity is open at a time, enforced by a partial unique index, and a re-raise of
an open alarm returns the one already open. A hand-raised alarm’s key defaults to its message; a key
beginning rule: is reserved for rules and refused (a 422).
Raising or clearing an alarm recomputes health in the same transaction, and the rollup records the
transition as a calculated property sample (source_rule='health-rollup'). An open alarm moves its
component by the effect its level declares; only an outage component stops filling its
slots.
An alarm’s audit rows outlive it. Every row other than the raise carries the field it moved in both
images (cleared_at, acknowledged_at or snoozed_until) and names the alarm, the component and the
dedup key, so the row says on its own what was done. Removing an alarm (deleting its component does
today, and retention will, #1339) never touches audit_log
(audit,
ADR-1442).
The alarm’s timeline
Section titled “The alarm’s timeline”An alarm’s history is one read (#950): GET /components/{name}/alarms/{id}:timeline
(omniglass component alarm timeline <name> <id>, gated alarm:read). It merges, oldest first:
- the events that carry the alarm (
event.alarm_id): the rule’s fire event that opened it and its clear event that resolved it; - its audit rows: the raise, each acknowledgement, snooze and unsnooze, the clear, and a rule edit that turned a severity on or off, naming the editor;
- the notifications it caused, each after the edge that queued it, with its delivery status as it stands.
Each entry says when, which kind, what, and who: the person who acted, or the rule the entry belongs to. At one instant an event sorts before the audit row it caused, since both share the transaction’s clock. The read is two bounded statements over the component the route already resolved, never a read per entry; a component outside the caller’s read scope is the same non-disclosing 404 an unknown one is. A hand-raised alarm writes no events, so its timeline is its audit rows. In the console every alarm row carries a clock button that opens its timeline under the row.
Acknowledgement: a fact about a person
Section titled “Acknowledgement: a fact about a person”An alarm’s raised state is a fact about the fault, decided by whoever raised it. An acknowledgement is a fact about a person: somebody has seen this. They are orthogonal, stored as two nullable columns rather than one status, so an alarm sits in any of four states:
| unacknowledged | acknowledged | |
|---|---|---|
| raised | nobody has looked: the queue an operator works | somebody is on it, and it is still broken |
| cleared | it came and went unattended | it was seen, then fixed |
POST /components/{name}/alarms/{id}:acknowledge records it, gated alarm:acknowledge (held by
operator and above, #728).
- It does not recompute health. Acknowledging is not fixing, and the health history is edges only.
- It has its own permission and scope, resolved on the component tier from
alarm:acknowledgeitself, not fromcomponent:update: a responder may hold one without the other. - It is idempotent. The first sighting is the one that matters (time to acknowledge), so a second keeps the first person and time and writes no second audit row.
Un-acknowledging is not a verb; if it ever matters it is a second verb and a second decision.
Resolve is deliberately absent. It is either clear under another name, or a concept nobody has specified: a person “resolving” an alarm whose raised state belongs to its rule is a contradiction until somebody says what it means (ADR-0109).
Snooze: silencing an alarm for a while
Section titled “Snooze: silencing an alarm for a while”A snooze says: stop telling people about this alarm for a while (#1318). It sits on the alarm’s
identity, (component, dedup_key), not on one alarm row: by the time an operator sees a raise it has
already been sent, so a snooze on one row could only hold back its clear. An alarm that flaps opens a new
row on every re-raise, and one snooze covers each of them until its deadline
(ADR-1318).
omniglass component alarm snooze display-1 <alarm-id> --duration 1homniglass component alarm unsnooze display-1 <alarm-id>:snooze takes a duration from 1m to 7d, run from now; outside that bound is a 422, since longer
is a maintenance window or a paused rule. It may be set from any row of the alarm, cleared ones included
(silencing one that has just cleared is the usual case for a flapping alarm). Snoozing again replaces the
deadline; :unsnooze ends it early and is a 200 that writes nothing when nothing is snoozed. Both are
gated alarm:snooze (held by operator, not by viewer), scoped like acknowledgement, and audited on
the alarm they were called on, so they appear on its timeline. Every alarm read carries snoozed_until
and snoozed_by while it holds.
What it holds back: every notification of the alarm. While the alarm is snoozed, each row the action
rules would write for a raise or a clear is written with the terminal status suppressed, the reason
in last_error. Nothing is sent, nothing reaches an inbox, and the timeline keeps every suppressed row. A
row already queued and waiting out a retry is suppressed when its turn comes, so “stop telling me” also
stops the retry on its way. A suppressed row is never released or retried.
When it ends, an alarm still raised is announced again, as a plain raised transition judged against
the rules and memberships as they stand then; one that cleared during the snooze gets nothing. The held
rows are never replayed, so nobody gets a backlog of stale messages. The deadline sweep runs on the
notification tick (every 2 s) and takes each expired snooze FOR UPDATE SKIP LOCKED, deleting it in the
transaction that queues its announcement, so two replicas never announce one alarm twice.
A snooze governs notifications and nothing else: it does not acknowledge, does not move health, is not ended by a clear, and notifies nothing itself except at its end.
The event_rule
Section titled “The event_rule”An event rule watches one sample key on the components it selects, and fires when its criteria hold and clears when they stop (#819, #918; ADR-0144). There is no separate alarm rule.
event_rule: name: reach-lost sample_key: endpoint-reachable # a property (text) or a metric (number) fire_criteria: { expr: 'value == "down"' } clear_criteria: { expr: 'value == "up"' } # optional: absent, it clears on !(fire) fire_sustain: 30s # how long fire must hold clear_sustain: 0s # how long clear must hold sample_window: 0s # a metric's trend rule: the history its criteria read severity: high # optional: absent, informational (no alarm) fire_event_type: rule-fired # the event written when it fires clear_event_type: rule-cleared # optional: the event written when it clears selector: { component_types: [display], components: [] } # empty: every componentThe selector picks components whose type falls within a listed component type (subtypes included) and components listed by id; empty, every component. A rule outlives what it points at: deleting a component or a key it reads leaves it editable, matching nothing.
Firings, alarms and events
Section titled “Firings, alarms and events”A rule is firing on a component and instance while it holds a row in event_rule_firing, whether
or not it raises an alarm; each such stretch is one firing. When a rule fires it writes the firing,
opens its alarm when it has a severity, and writes its fire event; when it clears it deletes the
firing, resolves the alarm, and writes its clear event if it names one
(ADR-0145).
Each happens once per edge, never per sample, in one transaction with the alarm transition and the health
recompute.
- The alarm is optional. A rule with no severity is informational and raises none.
- The events are typed, by name from the event type catalog: a required
fire_event_typeand an optionalclear_event_type. The platform seeds a generic pair,rule-firedandrule-cleared; a rule may name a pair the catalog already models (call-started,call-ended). A type a rule names cannot be deleted. - The event is derived:
origin = derived, naming its rule inderived_by_rule_idand, insource_rule, the rule’s name and version as they were when it was written. It carries the rule’s message, the sample’s key and value, and the alarm it opened or resolved inevent.alarm_id. - Turning a severity on or off opens or resolves alarms for the current firings and writes no event, since the firing did not move; the alarm’s audit rows name the editor.
A rule’s alarm is identified by the rule’s uuid and the sample’s instance: its dedup key is
rule:<uuid>[:<instance>], so a per-endpoint input holds one alarm per endpoint, and one recovering
clears only its own. Every path that reads a rule’s alarms matches on raised_by_rule_id plus that
instance (#977), so an alarm a replica from before #977 keyed by the rule’s name still counts during a
rolling upgrade, and a key never matches another rule’s alarm.
A hand clear holds until the rule clears and fires again. Firing is the firing row, not the alarm, so an operator clearing a rule’s alarm leaves the firing alone, and a further sample that still meets the fire criteria does not reopen it. The next alarm opens on the next new edge, the same manual close a Zabbix trigger allows.
A rule’s name is renameable; everything refers to its uuid
(ADR-0076).
POST /event-rules/{name}:rename moves the name; alarms, firings, streaks, events and audit rows hold
the uuid, so nothing else moves and no version bumps. An official rule keeps its name (a 409), since the
boot seed matches it by name.
Disabling or deleting a rule clears its firings, each with its clear event, resolving their alarms; narrowing its selector ends those on the components it no longer watches.
Judged as samples land
Section titled “Judged as samples land”The evaluator judges each sample in the ingest transaction, through the same guarded write, audit row and health recompute a hand-raised alarm uses, acting as the system actor. A repeated or redelivered sample changes nothing.
Sustains hold an edge until it has lasted: fire_sustain before firing, clear_sustain before
clearing, both defaulting to 0s and set independently (a long clear sustain holds an alarm through a
noisy recovery without delaying the raise). A sample pointing at an action starts or continues a
streak, stored per rule, component and instance in event_rule_state so it survives a restart; a
sample pointing nowhere, at an action already taken, or that the rule cannot evaluate breaks it. Once a
streak has held for its sustain, the action takes effect on a later sample or on the server’s sweep
(every 5 s), which is what lets a sustain work on an input that reports only on change. The sweep
re-judges the series’ newest sample first. Sustains are timed by the server’s receipt of each
sample, never the sample’s own timestamp, so an outpost whose clock lags neither skips nor stretches one.
Only a material edit (key, criteria, selector, sustains) restarts a rule’s streaks. Creating, enabling or materially editing a rule primes it from each selected series’ newest sample, so criteria that already hold start their sustain at once instead of waiting for a change the input may never send.
A component can also move into or out of a rule’s selection without the rule changing, when it changes
type. The storage step for that (reselectComponentRules, #2475) primes the rules it came into and ends
the firings of the rules it left. No component, product or type write calls it yet (#941, #1920).
A reconcile pass (#928) heals the narrow races left: a rule enabled while a batch carrying its key is uncommitted, or a judgement Postgres aborts on a deadlock. Once a minute, on a loop of its own, it re-judges each enabled rule’s newest sample on every series that took one since the pass before last and corrects only what disagrees, each correction in its own transaction under the ingest’s lock order. Agreement, the common case, costs no write. It finds new samples by id through each day’s block range index, so a finished day costs a few index pages (ADR-1929).
Criteria are expressions
Section titled “Criteria are expressions”Criteria are expressions at the criteria site (#957), stored as
{"expr": "..."}, with four bindings: value (a metric’s number, or a property’s value typed by its
data type), key, instance (the sample’s endpoint, empty when none) and component (its name and
type). A metric’s criteria may also read window and age
(below). A criterion must yield true or false; one that
does not compile is refused at write (a 422 naming the criteria, line and column). A rule with no clear
criteria clears on !(fire).
The short form {op, value} is still accepted on input and lowered to its expression (ge 80 is
value >= 80.0); the API always answers with the expression. Criteria compile once per rule version. A
stored rule whose criteria no longer compile (a key’s data type changed under them) holds the rule and
says so in criteria_error; a compile warning (value == 21.5 on a measured number) rides in
criteria_warnings and never holds it. A sample the criteria cannot read, or a run over the site’s
budget, holds the rule for that sample, logged once per rule version; the sample still lands
(ADR-0146).
Preview (POST /event-rules:preview, gated rule:read, #959) judges a candidate over the last 24
hours of its key’s samples on the components the caller may read, with no sustains, and answers the
edges it would have written and where it would be firing now. It writes nothing, and caps its reads,
flagging truncated when it hits the cap. Criteria that read a window or an age are refused there,
since a preview judges each sample alone.
Reading a rule
Section titled “Reading a rule”Rules read like a catalog: any rule:read grant lists and gets every rule. Writing one takes rule:*
on an all-scope grant, since a selector reaches every component. A version bumps on every change.
A rule’s live state is a read, not a column: GET /event-rules/{name}/state (omniglass event-rule state list <rule>) returns its firings, its open alarms and its streaks waiting out a sustain. The list
carries the same as counts (firing, open_alarms, pending_streaks), aggregated in one query, and
last_judged_at, which tells a quiet rule from one whose key has stopped arriving (#929): an ingest
batch stamps it at most once every 5 s, in its own event_rule_live row, never on the rule row. The
state names components, so it covers only those the caller’s component read scope admits. The console’s
Catalog > Actions > Event rules page lists every rule with its criteria in words, its severity and
those counts, and authors operator rules in a drawer; official rules are read-only.
The shipped rules
Section titled “The shipped rules”The platform ships official rules, rendered here from the seed:
| Rule | Reads | Fires | Clears | Writes | Severity |
|---|---|---|---|---|---|
reachability-lost (Reachability lost) | endpoint-reachable | value == "down" for 15s | value == "up" | rule-fired, rule-cleared | high |
ingest-lag-high (Ingest lag high) | ingest-lag-max | value > 30 for 2m | value <= 30 | rule-fired, rule-cleared | warning |
outpost-silent (Outpost silent) | checkin-age | value > 90 | value <= 90 | rule-fired, rule-cleared | high |
rule-sweep-stalled (Rule sweep stalled) | rule-sweep-age | value > 30 | value <= 30 | rule-fired, rule-cleared | high |
worklist-stale (Worklist stale) | worklist-pull-loss-ratio | value == 1 for 2m | value < 1 | rule-fired, rule-cleared | warning |
disk-nearly-full (Disk nearly full) | data-dir-disk-used-ratio | value > 0.9 for 2m | value <= 0.85 | rule-fired, rule-cleared | warning |
retention-behind (Retention behind) | retention-behind | value == 1 for 5m | value == 0 | rule-fired, rule-cleared | warning |
process-heap-growing (Process heap growing) | process-heap-size | age >= 86400 && span(window) >= 18000 && growth(window) > 0.25 for 1h | growth(window) <= 0.1 | rule-fired, rule-cleared | average |
process-goroutines-growing (Process goroutines growing) | process-goroutine-count | age >= 86400 && span(window) >= 18000 && growth(window) > 0.25 for 1h | growth(window) <= 0.1 | rule-fired, rule-cleared | average |
db-size-growing (Database size growing), shipped disabled | db-size | age >= 604800 && span(window) >= 72000 && growth(window) > 0.25 for 6h | growth(window) <= 0.1 | rule-fired, rule-cleared | average |
reachability-lostcloses the monitoring loop with no operator: an endpoint readingdownfor the sustain opens ahighalarm on its component, which goes to outage and stops filling its slots, and readingupclears it. Whether that takes a system out is the slot’s impact and quorum.outpost-silentopens ahighalarm on a claimed outpost’s own component once itscheckin-age, which the server writes every 15 s, passes 90 s (outposts).ingest-lag-high,disk-nearly-full,retention-behindandrule-sweep-stalledwatch the server’s own component (collection, storage);disk-nearly-fullfires over 0.9 and clears only at 0.85, so a disk at the line does not flap.- The trend rules
process-heap-growing,process-goroutines-growinganddb-size-growingare below.
A trend rule reads a window, not a sample
Section titled “A trend rule reads a window, not a sample”A rule on a metric can judge where its series is heading (#1985). Its sample_window (up to a week)
binds the series’ points over that window as window, oldest first, each a record of value and
at (unix seconds). The trend functions fold it: slope(window)
is the least-squares rise per second, span(window) the seconds covered, and growth(window) the fitted
rise as a share of the series’ mean. A leak reads:
event_rule: name: process-heap-growing sample_key: process-heap-size sample_window: 6h fire_criteria: { expr: 'age >= 86400 && span(window) >= 18000 && growth(window) > 0.25' } clear_criteria: { expr: 'growth(window) <= 0.1' } fire_sustain: 1hA fit, not the newest point less the oldest: noise on a flat series averages near zero, and one outlier at either end does not read as a rise. The gap between fire and clear keeps a series on the line from flapping.
Not every rise is a trend: a fresh database grows as its retention windows fill, and a restarted process
refills its caches for hours. So a metric’s criteria also bind age, how long the series has run.
On a process’s own runtime keys it is the process’s uptime (a restart resets it); on any other key it is
the time since the series’ oldest kept sample, so it never passes the metric lane’s retention. The
process rules wait a day of uptime and db-size-growing a week. An age cannot tell bloat from a fleet
that grew, though, so db-size-growing ships disabled; an operator who wants it authors their own
rule from its criteria. The shipped-rule test walks each trend rule through the healthy growths it must
not fire on, and a rule ships enabled only if none fires it.
The store reads the window, not the expression, so the evaluator stays a pure function and a trend is
unit-testable on a fixed series. The window arrives as at most 360 even buckets, each the mean of its
newest four samples, so a read touches at most 1,440 rows a series. A sample_window its criteria never
read, or criteria reading window without one, is refused at write. The reconcile pass re-judges trend
series too, since a trend can move with no sample arriving, at most 200 a pass
(ADR-1985).
Severity: a catalog of named levels
Section titled “Severity: a catalog of named levels”Severity is a catalog of named levels, not a bare integer. A level has the ordinary identity (a name,
an optional label, a uuid id), plus a color, a rank used only for comparison (higher is worse),
and a health_effect: what an open alarm at that level does to its component, none, degraded
or outage (#2558). Rules and alarms name a level by name; a rename carries its alarms, and a level an
alarm names cannot be deleted. The shipped levels, rendered from the seed:
| Level | Color | Rank | An active alarm at it |
|---|---|---|---|
info (Info) | gray | 10 | does not affect its component's health |
warning (Warning) | yellow | 20 | degrades its component |
average (Average) | orange | 30 | degrades its component |
high (High) | red | 40 | puts its component in outage |
disaster (Disaster) | darkred | 50 | puts its component in outage |
The official levels ship spaced, so an operator inserts a level between two without renumbering.
The set is operator-customizable (relabel to P1/P2/P3, recolor, insert, three levels or seven) at
/severity-levels (omniglass severity-level create), gated severity_level:* on an all-scope grant:
a level’s health effect moves health fleet-wide, so a holder whose grant stops at one location reads
the levels and writes none (#917, #930). A name or rank already taken is a 409; official levels are
read-only. A custom level created without an effect takes the one its rank implies (below warning
none, below high degraded, else outage). Changing a level’s effect recomputes every component with an
open alarm at it. The API’s outage flag remains as a deprecated alias of health_effect being
outage.
The console reads the catalog wherever a severity shows: every alarm chip renders the level’s label in
its color and sorts by its rank, so an operator level renders like a shipped one. Catalog > Actions >
Severity levels lists them worst first and authors operator levels in a drawer whose form shows where
a rank sits among the levels. An alarm whose level declares none says on its component that it does
not affect health.
Notifications
Section titled “Notifications”A notification is one message about an alarm, sent on one channel to the people or tools somebody already watches (#618). It is distinct from a command, sent to a component, and from an event, a record that is never sent. The lane is three catalogs and a delivery row, each answering one question:
- a notification type says what a message says;
- a notification target says where it goes;
- an action rule says when it is sent;
- a notification is one message on its way.
Notification types: what a message says
Section titled “Notification types: what a message says”A notification_type carries a label, a description, the official flag, and two rules: a
one-line subject and a body text. The shipped types are authoritative on every boot and read-only;
an operator writes their own beside them and renames one with :rename.
| Type | Subject | Text |
|---|---|---|
alarm-raised (Alarm raised) | [{{.SeverityLabel}}] {{.ComponentLabel}}: {{.Message}} | {{.ComponentLabel}}{{if .Location}} at {{.Location}}{{end}} raised a {{.SeverityLabel}} alarm: {{.Message}}
Raised at {{.RaisedAt}}{{if .Rule}} by the rule {{.Rule}}{{end}}.
{{if .Link}}{{.Link}}{{end}} |
alarm-cleared (Alarm cleared) | [Cleared] {{.ComponentLabel}}: {{.Message}} | {{.ComponentLabel}}{{if .Location}} at {{.Location}}{{end}} cleared its {{.SeverityLabel}} alarm: {{.Message}}
Raised at {{.RaisedAt}}, cleared at {{.ClearedAt}}.
{{if .Link}}{{.Link}}{{end}} |
Each rule is written in the label rule language and run by the same sandbox
(internal/sandbox): a closed grammar (if, comparisons and the label rule’s functions; printf,
call, index, range and variables are refused at write, a 422 naming the construct) over a closed
map of strings, with the source, each call’s arguments and each fact’s length capped. The map is the
alarm facts, declared once beside the code that builds them; a fact outside it renders empty, and no
secret is in it:
| Key | What it holds |
|---|---|
{{.Component}} | The component's name. |
{{.ComponentLabel}} | How the component reads: its label, else its name. |
{{.ComponentType}} | The label of the component type its product classifies it as; empty for a component with no product. |
{{.Location}} | How the location the component sits at reads (its label, else its name); empty when it sits at none of its own. |
{{.Severity}} | The severity level the alarm was raised at, by name. |
{{.SeverityLabel}} | That level's label, else its name. |
{{.Message}} | The alarm's message: what its rule says, or what the operator who raised it wrote. |
{{.Transition}} | The edge this message is about: raised or cleared. |
{{.RaisedAt}} | When the alarm was raised, RFC 3339 in UTC. |
{{.ClearedAt}} | When it was cleared, RFC 3339 in UTC; empty while it is raised. |
{{.Rule}} | The event rule that raised it, by name; empty for an alarm an operator raised. |
{{.Link}} | The component's page in the console, built on the notification.console_url setting; empty while that is unset. |
A rendered subject is at most 200 characters and a text at most 4000; past either, the render fails rather than cutting the message.
Link is built on the console_url key of the notification settings
namespace, since the server cannot know the name a receiver reaches it by.
POST /notification-types/{name}:preview renders a type, or a draft of either rule, against a real alarm
the caller can read, exactly as a delivery would carry it, and writes nothing. The console’s
Catalog > Actions > Notifications page edits and previews through it; its neighbours Action rules
and Notification targets (#1346) author the other two catalogs.
Notification targets: where a message goes
Section titled “Notification targets: where a message goes”A notification_target names a kind, a destination and, optionally, the credential it proves itself
with. The kinds are a code-declared enum:
| kind | reaches |
|---|---|
webhook | a URL: a chat incoming webhook, a paging service |
email | a fixed set of addresses, a shared mailbox |
user_group | every person in a group, on the channels named (below) |
user | one person, on the channels named |
role | every person holding a role (below) |
A target is platform-owned and admin-only: every route takes an all-scope notification_target:*
grant, and nothing below admin holds one. A webhook URL is itself a credential, so every read masks it to
its scheme and host, the audit log records it masked, and :reveal returns it whole under an audit row
of its own. The bound credential is a platform secret of type hmac-key (the send signs each body)
or bearer-token (the send presents it). Binding one takes secret:bind on it, and so does moving the
URL of a target that keeps one, since every send hands the credential to whatever the URL names
(ADR-2047).
A bound secret cannot be deleted from under its target. POST /notification-targets/{name}:test sends
one synthetic message (transition test, about no alarm), answers what the receiver said, and records
only its audit row.
The send is render, then sign, then send. The body is a fixed, versioned JSON envelope: the rules
render strings, never the JSON itself, so an operator’s rule cannot produce an invalid body. The
signature covers the exact bytes sent and is the scheme the inbound hmac webhook verifies, so a
receiver can prove the sender, and Omniglass can verify its own notifications.
The JSON body of a webhook notification. Headers: Idempotency-Key (the id), X-Omniglass-Timestamp (unix seconds), X-Omniglass-Signature (sha256=hex hmac-sha256 over timestamp.body, when the target binds an hmac-key secret), X-Omniglass-Event: notification.
| Field | Type | What it holds |
|---|---|---|
alarm_id (optional) | string | The alarm's uuid; absent on a test send |
facts | object of strings | The alarm facts the templates read, every key present (an absent fact is the empty string): the same map a template renders over |
id | string | The notification's uuid, the same on every attempt; the Idempotency-Key header carries it too, so a receiver can drop a redelivery |
subject | string | The rendered subject, one line |
text | string | The rendered text |
transition | raised | cleared | test | heartbeat | The alarm edge the message is about; test for a target's :test send and heartbeat for the server's own heartbeat, which are about no alarm |
type | string | The notification type that rendered it, by name |
version | integer | The envelope version; this document describes version 1 |
People: group and person targets, and the inbox
Section titled “People: group and person targets, and the inbox”A user_group or user target names people and the channels to reach them on: inbox (the
console inbox) and email (each person’s directory email) (#1341). It rides a rule’s targets exactly as
a webhook does:
omniglass notification-target create --name on-call-page --kind user_group \ --user-group on-call --channels '["inbox"]'omniglass action-rule create --name page-on-call --on '["raised"]' \ --when 'severity_rank >= 50' --targets '["on-call-page"]'- A group expands at the transition, in the alarm’s own transaction, so a member added later is told on the next alarm and a removed one is not, with no rule edited.
- Only people are told: active, unarchived persons among the members; a machine user or an outpost in the group is skipped.
- One row per person per channel, each with its own delivery state; a person one rule reaches twice is told once.
- Nobody is told about an alarm they could not read. Each candidate is kept only when their own component read scope admits the alarm’s component. The check is set-based, so it costs the same for a group of two or two hundred, and it runs under the notification savepoint, so it can never fail the transition (ADR-1341).
The inbox is a person’s own inbox rows, delivered by their own commit (written sent) with a
read_at. GET /auth/me/notifications lists the caller’s entries newest first with the unread count;
:markRead and :markAllRead mark them, audited, and only the caller’s own. Every inbox read is
scoped again by the caller’s component read scope as it stands, so an entry about a component they
have since lost is gone.
A person-addressed row is visible wherever its alarm is, so the alarm’s history stays whole, but its
recipient is named only to that person and to holders of user:read:admin
(identity and access). Binding a group
or a person to a target takes user_group:read:admin or user:read:admin on top of
notification_target:create, and a group or person a target names cannot be deleted from under it.
Role targets, and the shipped platform routing
Section titled “Role targets, and the shipped platform routing”A role target (#1987) reaches every person holding a role, directly or through a grant to one of
their groups, read from the grant table at the transition: grant someone admin and the next alarm
tells them. A person reached twice is told once, and the per-person scope check still decides which
alarms each holder hears about. Binding one takes role:read:admin and user:read:admin; a role a
target names cannot be deleted from under it.
Platform alarms reach the admins by default. The boot seed ships two targets and one rule, so a fresh install tells somebody when Omniglass itself is unwell:
platform-admins, aroletarget namingadmin, oninbox;platform-owners, aroletarget namingowner, oninbox(owner does not inherit admin, and the bootstrap user holdsowner);platform-alarms-to-admins, an action rule onraisedandclearedwithwhen: platform, sending to both.
platform is true when the alarm’s component is one of Omniglass’s own parts, a member of the reserved
platform system. The three rows are official: the seed puts back
what it ships on every boot, and an edit or delete of those fields is a 409. What an operator owns
survives: disabling the rule or a target, a target’s label, and extra targets added to the rule. The
shipped targets are inbox only; an email channel would fail a row per person on every install with no
mail relay set (#2016), so an operator who wants mail adds an email-channel role target of their own.
Email: a shared mailbox, and a person’s directory email
Section titled “Email: a shared mailbox, and a person’s directory email”Email goes through the install’s mail relay (#1317), set in the notification settings namespace:
mail_relay (host:port; empty turns email off), mail_security (starttls, the default; tls; or
none), mail_from, and mail_secret, a platform basic-auth secret. The relay is judged by the same
egress contract a webhook is: an internal relay only when egress_allow
names it, and a credential never crosses an unencrypted session to anything but loopback. A settings
patch that binds or moves a mail_secret takes secret:bind on it.
An email target sends to its addresses. A person’s email row sends to their directory email,
resolved at send, after the tick judges the recipient again in the row’s own transaction: still an
active person, still in the group the row came through, still able to read the alarm’s component. If
not, the row fails at once with the plain reason rather than mailing somebody who lost the alarm while
it waited out a retry. The message’s Message-ID is the row’s uuid, so every attempt carries the same
bytes.
Opting out. An admin may mark a platform rule opt_out_allowed (default false, so an on-call page
cannot be opted out of unless an admin says so). A member of a group it targets may then opt out with
POST /action-rules/{name}:optOut and back in with :optIn (notification:subscribe, #1354). A target
naming them directly still tells them, and turning opt_out_allowed off withdraws every opt-out.
Personal action rules: subscribing yourself
Section titled “Personal action rules: subscribing yourself”A personal action rule (#1353) is an action rule with an owner (owner_user_id) and the channels it
tells its owner on, and no targets: its only recipient is its owner. It lives under
/auth/me/action-rules, gated notification:subscribe, which viewer carries, so everyone who can see
alarms can subscribe. Another user’s rule is a 404 on every verb, and a person owns at most 50.
omniglass auth me action-rule create --name my-boardroom --on '["raised"]' \ --when 'location == "Boardroom" && severity_rank >= 40' --channels '["inbox","email"]'omniglass auth me action-rule test my-boardroom --when 'severity_rank >= 50'It never matches outside its owner’s scope: an alarm on a component the owner cannot read is skipped
before the rule’s when runs, so neither a delivery nor the when’s own failure can tell them anything
about it. :test (and :testDraft for an unsaved draft) judges the rule against the owner’s recent
alarms and says which it would have told them about, sending nothing.
The action_rule: when a message is sent
Section titled “The action_rule: when a message is sent”An action rule wires an alarm transition to a notification: on one or both transitions
(raised, cleared), when a predicate over the alarm facts holds, send a notification type
(absent: the official one for the transition) to its targets. It is a rule, so it rides rule:*,
read like a catalog and written all-scope. Its enabled flag pauses it: a disabled rule queues nothing,
and what it queued before still delivers.
omniglass action-rule create --name page-ops --on '["raised","cleared"]' \ --when 'severity_rank >= 40 && location == "Boardroom"' --targets '["ops-chat"]'when is the action site of the expression engine: its bindings are
the alarm facts in snake_case (component, location, severity, message, rule, …), plus
severity_rank (so severity_rank >= 40 is high and above) and platform. An empty when always
holds. Acknowledgement and snooze never notify, since an operator act is not an alarm’s edge; a clear
is, whoever records it. One message per transition per rule per target: no grouping and no digest yet.
Delivery: the notification row
Section titled “Delivery: the notification row”A notification is a stateful row with its own delivery state: queued, sent, failed, or
suppressed (written while its alarm was snoozed, never
sent). It is written in the same transaction as the alarm transition, at the one seam every raise and
clear passes, so no transition is lost and none is written twice, and it is rendered then, so a retry
sends the same bytes and a preview is what a delivery carries.
A server tick (every 2 s) drains due rows, one per transaction under FOR UPDATE SKIP LOCKED, sending
while the row is locked, so two replicas never send one twice outside the crash window between a send
and its commit, and a restart loses nothing
(ADR-0618).
A failed attempt waits 10 s, doubling; the 8th failure is final (about 21 minutes in all). Every attempt
carries the same Idempotency-Key, the row’s uuid, so a receiver drops a redelivery.
A transition never waits on this lane: the queue reads the rules, types and targets it matches
FOR KEY SHARE SKIP LOCKED, so a rule someone is deleting is skipped for that transition rather than
making the raise wait on a slow send (#1335).
A failed row that was attempted is re-queued with POST /notifications/{id}:retry
(notification:retry, an operator’s), from the timeline or the CLI. GET /notifications lists rows by
alarm, target or status, and every read is scoped by the alarm’s component, as the alarm reads are.
Durability and egress
Section titled “Durability and egress”Delivery is at-least-once with an idempotency key, the pipeline is render, sign, send, and the
dead-letter surface is the failed row on the alarm’s timeline with its :retry. All of it sits in
Postgres, drained by a tick, rather than on a JetStream consumer fed by change-data capture: a deliberate
divergence (ADR-0618).
Egress safety is one primitive, internal/egress, the server’s only outbound HTTP client, which every
sender (a webhook, the mail relay, the heartbeat, a document fetch) consumes rather than rewrites:
- A loopback, private, link-local, unique-local or carrier-grade NAT destination is refused unless the
admin-only
egress_allowsetting names it; a cloud metadata address is refused even when named. - The check runs on the address actually dialed, after resolution, so a name that resolves somewhere else at send time is judged where it goes. A zoned IPv6 address is refused; one that embeds an IPv4 destination (NAT64, 6to4, Teredo) is judged as that destination.
- https always, plain http only to a destination the allow list names; TLS verified; a redirect is the receiver’s answer, never followed; every phase bounded; no proxy from the environment.
- A failed send’s reason keeps a bounded excerpt of the answer, scrubbed of the URL and every credential.
The heartbeat: what an alarm inside the platform cannot see
Section titled “The heartbeat: what an alarm inside the platform cannot see”An alarm is raised by the thing it reports on, so the failures it can never report are those that stop
the server, its database or its network at once: silence reads as health. rule-sweep-stalled covers
the narrow case of a stalled sweep on a live server. For the rest there is a dead-man’s switch: a
signal whose absence is the alarm, watched from outside.
Name a webhook target in the heartbeat.target setting
and the server sends it a signed request every heartbeat.interval_seconds (60 by default, 10 to
86400). It is built and signed by the notification pipeline (a target with no hmac-key bound is
refused, never sent unsigned), sent through the egress contract, and audited. The body carries the
server’s name, its build and the count of open alarms on the platform’s own components. It is off by
default. Omniglass does not host the receiver: point it at any service that pages when a ping fails to
arrive within a grace period of a few intervals.
Cycle safety in the action layer
Section titled “Cycle safety in the action layer”The collection, sample and alarm core is acyclic by construction, and only data authors events: an event rule over samples is the only way a derived event enters the log. The loop left is the data-mediated control loop: an action commands a device, the new state arrives as a sample, opens an alarm, and fires the action again. Three rules close it:
- A rule never routes on its own consequences. Every consequence write is labeled
provenance='calculated'with its producer named (the health rollup’spropertyrow issource_rule='health-rollup'), and a calc rule’s write never marks the rule that produced it (ADR-0069). - Operator acts do not match action rules. An action rule fires on
raisedandclearedalone; acknowledging and snoozing queue nothing. The one exception, a snooze’s end re-announcing a raised alarm, re-sends a transition already announced and happens once, so it cannot loop. - The control loop is lineage-guarded at dispatch, needed once an action can run a command.
Namespacing
Section titled “Namespacing”Event rules, severity levels, notification types and action rules carry the catalogs’ official flag,
seeded through each catalog’s authoritative upsert: an official row ships vetted and is read-only, and an
operator’s row sits beside it. An official row never takes over an operator’s; a clash stops the boot
naming it. The shipped notification types are alarm-raised and alarm-cleared, and the shipped action
rule is the platform routing above.
Storage
Section titled “Storage”The physical layout lives on storage. The alarm row is component-local, with
its acknowledgement as two nullable columns rather than a status enum, since acknowledged and cleared are
not mutually exclusive.
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
severity | text | FK → severity_level.name, not null | A severity level by name (FK, ON UPDATE CASCADE); the rollup and the console sort on its rank |
message | text | not null, default ''::text | |
raised_at | timestamp with time zone | not null, default now() | When the alarm was raised |
cleared_at | timestamp with time zone | NULL while open; the one-open index keys on it | |
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() | |
component_id | uuid | FK → component.id, not null | The component the alarm is about |
dedup_key | text | not null | The alarm's identity (ADR-0075): one open alarm per (component, dedup_key), enforced by the partial unique index while open |
acknowledged_at | timestamp with time zone | When a person first recorded seeing it; NULL while nobody has. Orthogonal to cleared_at | |
acknowledged_by | uuid | FK → users.id | Who recorded it; ON DELETE SET NULL, so purging a user keeps the time, and audit_log keeps the name |
raised_by_rule_id | uuid | FK → event_rule.id | The event rule that raised it; NULL for a hand-raised alarm or once the rule is deleted |
source | text | not null, default ''::text | Empty for every alarm the platform raises; devseed for an alarm a throwaway lab seeded in the past (ADR-2726) |
CHECK constraints and unique indexes on alarm
-
alarm_open_identity_key:CREATE UNIQUE INDEX alarm_open_identity_key ON public.alarm USING btree (component_id, dedup_key) WHERE (cleared_at IS NULL)
A snooze is a row of its own, one per snoozed alarm identity:
| Column | Type | Constraints | Notes |
|---|---|---|---|
component_id | uuid | PK, FK → component.id | With dedup_key, the alarm identity (ADR-0075) the snooze is on; it goes with its component |
dedup_key | text | PK | The alarm snoozed; every row of it, past and future, reads the snooze while it holds |
snoozed_until | timestamp with time zone | not null | When it ends; the index on it is what the end-of-snooze sweep reads. Snoozing again replaces it |
snoozed_by | uuid | FK → users.id | Who set it; ON DELETE SET NULL, its name resolved when read, and audit_log keeps the name |
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() |
The event rule is the authored event_rule, the streak each rule holds per component and instance while
it waits out a sustain (event_rule_state), and the firing it holds (event_rule_firing). The severity
catalog is severity_level.
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
name | text | not null | |
label | text | ||
description | text | not null, default ''::text | |
selector | jsonb | not null, default '{}'::jsonb | Component types and components it watches; empty, every component |
sample_key | text | not null | The property or metric it reads, by name; sample_lane records which catalog |
sample_lane | text | not null | |
fire_criteria | jsonb | not null | The expression the rule fires on, {"expr": "..."} (#957); the short form {op, value} is lowered to it on input |
clear_criteria | jsonb | The expression it clears on, {"expr": "..."}; NULL clears on the negation of fire_criteria | |
fire_sustain | interval | not null, default '00:00:00'::interval | |
clear_sustain | interval | not null, default '00:00:00'::interval | |
severity | text | FK → severity_level.name | The level its alarms are raised at, by name; NULL is an informational rule, which raises no alarm |
message | text | not null, default ''::text | |
enabled | boolean | not null, default true | |
official | boolean | not null, default false | |
version | integer | not null, default 1 | Bumps on every change |
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() | |
fire_event_type_id | uuid | FK → event_type.id, not null | The event type written when the rule fires (FK event_type, required) |
clear_event_type_id | uuid | FK → event_type.id | The event type written when it clears; NULL writes none |
namespace | text | not null, default 'local'::text | |
sample_window | interval | not null, default '00:00:00'::interval |
CHECK constraints and unique indexes on event_rule
-
event_rule_clear_sustain_check:CHECK ((clear_sustain >= '00:00:00'::interval)) -
event_rule_fire_sustain_check:CHECK ((fire_sustain >= '00:00:00'::interval)) -
event_rule_namespace_check:CHECK ((namespace ~ '^[a-z0-9][a-z0-9-]*$'::text)) -
event_rule_og_official_check:CHECK (((namespace <> 'og'::text) OR official)) -
event_rule_sample_lane_check:CHECK ((sample_lane = ANY (ARRAY['property'::text, 'metric'::text]))) -
event_rule_sample_window_check:CHECK (((sample_window >= '00:00:00'::interval) AND (sample_window <= '7 days'::interval))) -
event_rule_namespace_name_key:CREATE UNIQUE INDEX event_rule_namespace_name_key ON public.event_rule USING btree (namespace, name)
| Column | Type | Constraints | Notes |
|---|---|---|---|
rule_id | uuid | PK, FK → event_rule.id | |
component_id | uuid | PK, FK → component.id | |
instance | text | PK, default ''::text | |
pending | text | not null | fire or clear: the action the samples point at |
since | timestamp with time zone | not null | The server receipt time the streak began; the sustain is measured from here |
CHECK constraints and unique indexes on event_rule_state
-
event_rule_state_pending_check:CHECK ((pending = ANY (ARRAY['fire'::text, 'clear'::text])))
| Column | Type | Constraints | Notes |
|---|---|---|---|
rule_id | uuid | PK, FK → event_rule.id | |
component_id | uuid | PK, FK → component.id | |
instance | text | PK, default ''::text | |
since | timestamp with time zone | not null | When the rule fired; one row while it is firing, for every rule |
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
name | text | not null | |
label | text | ||
color | text | not null, default ''::text | |
rank | integer | not null | Higher is worse; compares levels only. What an alarm does to its component is the level's health_effect |
official | boolean | not null, default false | |
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() | |
namespace | text | not null, default 'local'::text | |
health_effect | text | not null |
CHECK constraints and unique indexes on severity_level
-
severity_level_health_effect_check:CHECK ((health_effect = ANY (ARRAY['none'::text, 'degraded'::text, 'outage'::text]))) -
severity_level_namespace_check:CHECK ((namespace ~ '^[a-z0-9][a-z0-9-]*$'::text)) -
severity_level_og_official_check:CHECK (((namespace <> 'og'::text) OR official)) -
severity_level_rank_check:CHECK ((rank > 0)) -
severity_level_name_key:CREATE UNIQUE INDEX severity_level_name_key ON public.severity_level USING btree (name) -
severity_level_rank_key:CREATE UNIQUE INDEX severity_level_rank_key ON public.severity_level USING btree (rank)
The notification lane is the notification_type and notification_target catalogs, the action_rule
with the targets it sends to and its opt-outs, and the notification delivery row.
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
name | text | not null | |
label | text | ||
description | text | not null, default ''::text | |
on_transitions | ARRAY | not null | The alarm transitions it fires on: raised, cleared, or both (a CHECK holds the set) |
when_expr | text | not null, default ''::text | The predicate at the action expression site; empty always holds |
notification_type_id | uuid | FK → notification_type.id | The type it sends (ON DELETE RESTRICT for a platform rule; a personal rule is released to NULL); NULL sends the official one for the transition |
enabled | boolean | not null, default true | |
official | boolean | not null, default false | Shipped and read-only in its seeded fields |
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() | |
owner_user_id | uuid | FK → users.id | A personal rule's owner, its only recipient (ON DELETE CASCADE); NULL is a platform rule |
channels | ARRAY | not null, default '{}'::text[] | A personal rule's channels (inbox, email); empty for a platform rule, which has targets |
opt_out_allowed | boolean | not null, default false | Whether a member of a group it targets may opt out of it (default false) |
namespace | text | not null, default 'local'::text |
CHECK constraints and unique indexes on action_rule
-
action_rule_channels_check:CHECK ((((owner_user_id IS NULL) AND (cardinality(channels) = 0)) OR ((owner_user_id IS NOT NULL) AND (cardinality(channels) > 0) AND (channels <@ ARRAY['inbox'::text, 'email'::text])))) -
action_rule_namespace_check:CHECK ((namespace ~ '^[a-z0-9][a-z0-9-]*$'::text)) -
action_rule_og_official_check:CHECK (((namespace <> 'og'::text) OR official)) -
action_rule_on_check:CHECK (((cardinality(on_transitions) > 0) AND (on_transitions <@ ARRAY['raised'::text, 'cleared'::text]))) -
action_rule_owner_name_key:CREATE UNIQUE INDEX action_rule_owner_name_key ON public.action_rule USING btree (owner_user_id, name) WHERE (owner_user_id IS NOT NULL) -
action_rule_platform_name_key:CREATE UNIQUE INDEX action_rule_platform_name_key ON public.action_rule USING btree (namespace, name) WHERE (owner_user_id IS NULL)
| Column | Type | Constraints | Notes |
|---|---|---|---|
rule_id | uuid | PK, FK → action_rule.id | |
target_id | uuid | PK, FK → notification_target.id | A target it sends to; a target a rule names cannot be deleted (RESTRICT) |
| Column | Type | Constraints | Notes |
|---|---|---|---|
rule_id | uuid | PK, FK → action_rule.id | |
user_id | uuid | PK, FK → users.id | A person who opted out of the rule for themselves; read only while the rule is opt_out_allowed |
created_at | timestamp with time zone | not null, default now() |
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
name | text | not null | |
label | text | ||
kind | text | not null | webhook, email, user_group, user or role; a CHECK holds each kind to its own columns |
url | text | A webhook's destination; masked on every read, revealed whole under an audit row | |
secret_id | uuid | FK → secret.id | The platform hmac-key or bearer-token secret it signs or authenticates with; a bound secret cannot be deleted (RESTRICT) |
enabled | boolean | not null, default true | |
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() | |
user_group_id | uuid | FK → user_group.id | The group a user_group target reaches, expanded at every transition (ON DELETE RESTRICT) |
user_id | uuid | FK → users.id | The one person a user target reaches (ON DELETE RESTRICT) |
channels | ARRAY | not null, default '{}'::text[] | The channels a person target delivers on (inbox, email); empty for a webhook or an email target |
addresses | ARRAY | not null, default '{}'::text[] | An email target's recipients, a shared mailbox; empty for every other kind |
role_id | uuid | FK → role.id | The role a role target reaches, read from the grants at every transition (ON DELETE RESTRICT) |
official | boolean | not null, default false | |
namespace | text | not null, default 'local'::text |
CHECK constraints and unique indexes on notification_target
-
notification_target_kind_check:CHECK ((((kind = 'webhook'::text) AND (url IS NOT NULL) AND (user_group_id IS NULL) AND (user_id IS NULL) AND (role_id IS NULL) AND (cardinality(channels) = 0) AND (cardinality(addresses) = 0)) OR ((kind = 'email'::text) AND (url IS NULL) AND (user_group_id IS NULL) AND (user_id IS NULL) AND (role_id IS NULL) AND (secret_id IS NULL) AND (cardinality(channels) = 0) AND (cardinality(addresses) > 0)) OR ((kind = 'user_group'::text) AND (user_group_id IS NOT NULL) AND (url IS NULL) AND (user_id IS NULL) AND (role_id IS NULL) AND (secret_id IS NULL) AND (cardinality(addresses) = 0) AND (cardinality(channels) > 0) AND (channels <@ ARRAY['inbox'::text, 'email'::text])) OR ((kind = 'user'::text) AND (user_id IS NOT NULL) AND (url IS NULL) AND (user_group_id IS NULL) AND (role_id IS NULL) AND (secret_id IS NULL) AND (cardinality(addresses) = 0) AND (cardinality(channels) > 0) AND (channels <@ ARRAY['inbox'::text, 'email'::text])) OR ((kind = 'role'::text) AND (role_id IS NOT NULL) AND (url IS NULL) AND (user_group_id IS NULL) AND (user_id IS NULL) AND (secret_id IS NULL) AND (cardinality(addresses) = 0) AND (cardinality(channels) > 0) AND (channels <@ ARRAY['inbox'::text, 'email'::text])))) -
notification_target_namespace_check:CHECK ((namespace ~ '^[a-z0-9][a-z0-9-]*$'::text)) -
notification_target_og_official_check:CHECK (((namespace <> 'og'::text) OR official)) -
notification_target_namespace_name_key:CREATE UNIQUE INDEX notification_target_namespace_name_key ON public.notification_target USING btree (namespace, name)
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
alarm_id | uuid | FK → alarm.id, not null | The alarm it is about; written in that alarm transition's own transaction |
component_id | uuid | FK → component.id, not null | The alarm's component, denormalized for the scope filter every read injects |
transition | text | not null | |
rule_id | uuid | FK → action_rule.id | |
rule_name | text | not null | The action rule that queued it, kept by name after the rule is deleted (as type_name and target_name are) |
notification_type_id | uuid | FK → notification_type.id | |
type_name | text | not null | |
target_id | uuid | FK → notification_target.id | |
target_name | text | not null | |
subject | text | not null, default ''::text | |
text | text | not null, default ''::text | |
facts | jsonb | not null, default '{}'::jsonb | The alarm facts the rules rendered over, sent as the envelope's facts |
status | text | not null, default 'queued'::text | queued, sent, failed or suppressed; the partial index on due queued rows is what the tick drains |
attempts | integer | not null, default 0 | |
next_attempt_at | timestamp with time zone | not null, default now() | When the tick next tries a queued row: now, then 10s doubling after each failure |
last_status | integer | ||
last_error | text | ||
sent_at | timestamp with time zone | ||
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() | |
recipient_user_id | uuid | FK → users.id | The person it is addressed to; ON DELETE SET NULL, recipient_name keeping who it was |
recipient_name | text | The recipient by username; withheld on read from all but the recipient and user:read:admin | |
channel | text | not null, default 'webhook'::text | webhook, email, or inbox (delivered by its commit) |
read_at | timestamp with time zone | When its recipient read an inbox entry |
CHECK constraints and unique indexes on notification
-
notification_channel_check:CHECK (((channel = ANY (ARRAY['webhook'::text, 'email'::text, 'inbox'::text])) AND ((channel <> 'webhook'::text) OR (recipient_name IS NULL)) AND ((channel <> 'inbox'::text) OR (recipient_name IS NOT NULL)))) -
notification_status_check:CHECK ((status = ANY (ARRAY['queued'::text, 'sent'::text, 'failed'::text, 'suppressed'::text]))) -
notification_transition_check:CHECK ((transition = ANY (ARRAY['raised'::text, 'cleared'::text])))
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
name | text | not null | |
label | text | ||
description | text | not null, default ''::text | |
subject | text | not null, default ''::text | The one-line subject rule, rendered over the alarm facts; whitespace collapses |
text | text | not null, default ''::text | The body text rule; its lines are kept |
official | boolean | not null, default false | |
created_at | timestamp with time zone | not null, default now() | |
updated_at | timestamp with time zone | not null, default now() | |
namespace | text | not null, default 'local'::text |
CHECK constraints and unique indexes on notification_type
-
notification_type_namespace_check:CHECK ((namespace ~ '^[a-z0-9][a-z0-9-]*$'::text)) -
notification_type_og_official_check:CHECK (((namespace <> 'og'::text) OR official)) -
notification_type_namespace_name_key:CREATE UNIQUE INDEX notification_type_namespace_name_key ON public.notification_type USING btree (namespace, name)