Events
PartialAn event is our semantic assertion that something happened, in our vocabulary: a discrete, point-in-time occurrence the action layer reacts to, owned through the same exclusive arc as a sample. It is not a sample (the has-a-value-now razor): samples are what rules read, and events are what event rules produce. To operate event types, see the admin Events page. The model is ADR-0063.
The event_type catalog
Section titled “The event_type catalog”A sample and an event are different shapes, so each gets its own catalog: metric_type and
property_type for samples, event_type for events.
An event_type row is (name, label, payload_schema, official, ...). It is built: list, get and
custom-type create, update and delete over /event-types, with seeded official types
(call-started, command-issued) that are read-only and operator-extensible beside them. Declaring
types gives events a known schema and makes them inspectable.
Events: caught, caused, derived, scheduled
Section titled “Events: caught, caused, derived, scheduled”An event’s origin is one of four, none manufactured from a value flip (a transition is already two consecutive sample rows):
- caught: a component publishes a structured occurrence natively (an xAPI event, a webhook, an
SNMP trap), and a driver’s emit maps it to its event type
(an emit lands on any lane). Built: it is
validated against
event_typeand landed under the same owner confinement and reject-not-project as a metric. - caused: we issued a command, recorded as a
command-issuedevent. Built. - derived: an event rule fuses signals into an operator-meaningful fact. Built for event rules: a rule writes its fire event when it fires and its clear event when it clears, once per edge, in the same transaction as the alarm transition (alarms and actions).
- scheduled: the clock fired a schedule.
Raw log lines are a separate ingest lane, not events
(ADR-0066): the
component-only log_line table and the outpost-owned outpost_log self-log table
(ADR-0079).
Storage
Section titled “Storage”The event row is the semantic-occurrence log and event_type its key catalog. An event carries the
lineage columns that name what produced it (source_event_id, source_log_line_id,
derived_by_rule_id), a flat correlation_id that threads a causal chain, and a nullable alarm_id:
a rule’s fire event names the alarm it opened and its clear event the alarm it resolved. The component
and system event reads return the rule and the alarm on each such row. Layout and partitioning live on
storage.
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | bigint | PK | |
ts | timestamp with time zone | not null, default now() | |
owner_kind | text | not null | |
instance | text | not null, default ''::text | The sub-entity the occurrence is about, when the owner is not enough |
message | text | not null, default ''::text | |
attributes | jsonb | ||
provenance | text | not null, default 'observed'::text | |
source | text | not null, default ''::text | |
source_rule | text | ||
source_rule_version | bigint | ||
component_id | uuid | FK → component.id | |
system_id | uuid | FK → system.id | |
location_id | uuid | FK → location.id | |
outpost_id | uuid | FK → outpost.user_id | |
event_type_id | uuid | FK → event_type.id, not null | The registered key this occurrence asserts |
origin | text | not null, default 'caught'::text | How the event arrived: caught, caused, derived, or scheduled |
source_event_id | bigint | FK → event.id | Lineage: the parent event, when one event caused another |
correlation_id | text | Threads the causal chain flat, across lineage hops | |
source_log_line_id | bigint | FK → log_line.id | Lineage: the raw log line a derivation rule promoted |
derived_by_rule_id | uuid | FK → event_rule.id | Lineage: the rule that did the deriving; NULL when the rule is deleted or the event was caught |
alarm_id | uuid | FK → alarm.id | The alarm a rule's fire event opened or its clear event resolved; NULL for most events |
source_conduit_id | uuid |
CHECK constraints and unique indexes on event
-
event_origin_check:CHECK ((origin = ANY (ARRAY['caught'::text, 'caused'::text, 'derived'::text, 'scheduled'::text]))) -
event_owner_arc_check:CHECK ((((owner_kind = 'component'::text) AND (component_id IS NOT NULL) AND (system_id IS NULL) AND (location_id IS NULL) AND (outpost_id IS NULL)) OR ((owner_kind = 'system'::text) AND (system_id IS NOT NULL) AND (component_id IS NULL) AND (location_id IS NULL) AND (outpost_id IS NULL)) OR ((owner_kind = 'location'::text) AND (location_id IS NOT NULL) AND (component_id IS NULL) AND (system_id IS NULL) AND (outpost_id IS NULL)) OR ((owner_kind = 'outpost'::text) AND (outpost_id IS NOT NULL) AND (component_id IS NULL) AND (system_id IS NULL) AND (location_id IS NULL)))) -
event_owner_kind_check:CHECK ((owner_kind = ANY (ARRAY['component'::text, 'system'::text, 'location'::text, 'outpost'::text]))) -
event_provenance_check:CHECK ((provenance = ANY (ARRAY['observed'::text, 'calculated'::text, 'intended'::text, 'declared'::text])))
| Column | Type | Constraints | Notes |
|---|---|---|---|
id | uuid | PK, default uuidv7() | |
name | text | not null | |
label | text | ||
description | text | not null, default ''::text | |
payload_schema | jsonb | The JSON Schema an occurrence of this key promises its attributes satisfy | |
official | boolean | not null, default false | Shipped-canonical versus org-local; official rows are read-only |
registered_at | timestamp with time zone | not null, default now() | |
namespace | text | not null, default 'local'::text |
CHECK constraints and unique indexes on event_type
-
event_type_namespace_check:CHECK ((namespace ~ '^[a-z0-9][a-z0-9-]*$'::text)) -
event_type_og_official_check:CHECK (((namespace <> 'og'::text) OR official)) -
event_type_namespace_name_key:CREATE UNIQUE INDEX event_type_namespace_name_key ON public.event_type USING btree (namespace, name)