Monitors and alerts

An operation without a data team still needs to hear when a feed stops, a nightly build keeps failing or writeback to the ERP piles up in dead letters. Monitors are rules over the platform's own run records. Each rule watches one kind of resource, measures it every minute, opens an alert when its check fails, raises it when it gets worse and resolves it on its own when the condition clears. Alerts go by severity to email, Slack, Teams, a signed webhook or the inbox

9 kindsPipelines, syncs, automations, agents, AI functions, writeback, webhooks, edge agents and datasets
7 checksFailures in a row, in a window or as a rate, slow runs, silence, empty loads and dataset health
Every minuteEach rule is measured and its alerts updated
Self-resolvingAlerts close when the condition clears, with 30 days of history

In the platform today

Built
  • Monitors run in the platform service, defined under monitors: in ontology.yaml with groups, routes per severity, sendResolved, health and rules, each with an id, scope, one check, a severity and an optional runbook
  • Every 60 seconds by default, a service setting, the service measures each rule over ops.pipeline_runs, ops.sync_runs, ops.automation_runs, ops.agent_runs, ops.aifunction_runs, ops.writeback_outbox, ops.webhook_deliveries, ops.edge_agents and ops.dataset_health, and evaluates dataset health on a timer when a rule watches datasets
  • Alerts are in ops.monitor_alerts and their changes of state in ops.monitor_events; they are sent as the webhook events monitor.alert.opened, .escalated and .resolved through the webhook dispatcher, and listed and snoozed under /api/v2/monitors and on the Monitors screen in Admin
On request
  • Rules over an app's dependencies, sync lag against the source, paging tools beyond a webhook, routes per rule, acknowledging an alert and opening an issue automatically
Requirements
  • An administrator to write rules in ontology.yaml and to run a pass by hand
  • Administrators and the groups in monitors.groups to see, receive and snooze alerts
  • Notification destinations under notifications.destinations, or webhook subscriptions, for alerts to reach anyone outside the inbox
  • Runs to measure: a resource with no runs at all is not counted as quiet

Rules

A rule names what it watches with scope: a kind, which covers every resource of that kind including new ones as soon as they have a run, { kind: pipeline, resource: job-cost } for one, or a list of either. It has one check and a severity, low, medium (the default) or high. Rule ids are lower-case letters, digits, dots, dashes and underscores

monitors:
  groups: [project-leads]                 # who sees and snoozes alerts, besides administrators
  # per severity: a notification destination, webhook:<id> or inbox
  routes:
    high: [platform-email, inbox]
    medium: [inbox]
    low: []
  sendResolved: true                      # also send when an alert resolves
  # dataset health on a timer, when a rule watches datasets
  health: { every: 1h, minGap: 15m }
  rules:
    - id: pipeline-failing
      name: Pipeline failing
      scope: pipeline                     # every pipeline
      check: { consecutiveFailures: 2 }
      severity: high
      runbook: https://wiki.example/runbooks/pipelines
    - id: erp-writeback
      name: Writeback to the ERP dead-lettered
      scope: { kind: writeback, resource: erp }
      check: { failures: 1, window: 24h }
      severity: high
    - id: hangar-agent-quiet
      scope: edge
      check: { quietFor: 30m }
    - id: feeds-health
      scope: dataset
      check: { health: [late, low, high], highFactor: 2, escalateAfter: 3 }
      watch: { raw.pm_events: high, gold.notes: none }

What each kind reads

KindRead fromA run isFailed when
pipelineops.pipeline_runsA buildIts status is failed
syncops.sync_runsAn object syncIts status is failed
automationops.automation_runsAn automation runIts status is failed
agentops.agent_runsAn agent runIt failed, or stopped at its step or cost limit
aifunctionops.aifunction_runsAn AI function runIts status is failed
writebackops.writeback_outbox, by systemA writeback that finishedIt reached the dead letters
webhookops.webhook_deliveries, by destinationA delivery that finishedIt failed for good
edgeops.edge_agentsA heartbeatHeartbeats only go quiet
datasetops.dataset_healthA health evaluationLate, low volume or high volume

Runs still in progress, pending, retrying, skipped or muted, are not counted

Checks

CheckFails when
{ consecutiveFailures: 3 }The latest 3 runs all failed
{ failures: 1, window: 24h }At least 1 run failed in the window, such as any dead letter
{ failureRate: 0.25, window: 24h, minRuns: 5 }A quarter or more of the window's runs failed, once it has 5 runs
{ p95Above: 10m, window: 24h, minRuns: 5 }The 95th percentile run time in the window is above 10 minutes
{ quietFor: 6h }No run or heartbeat for 6 hours. A resource that never ran is not quiet
{ emptyLoad: true }A pipeline's latest successful build wrote no rows, or a dataset's latest load had none
{ health: [late, low, high] }A dataset is late, or below or above its usual volume. The default is all three

Dataset health on a timer

Dataset health learns each dataset's usual freshness and volume. When a rule watches datasets, each monitor pass evaluates every dataset again when one has a new version or has passed its expected update time, at most every health.minGap (15 minutes) and at least every health.every (1 hour), so the health screen stays whole

  • Two severities. The rule's own severity for health's bounds, and high when the dataset is also outside bounds highFactor times looser (2 by default: late by twice the allowed gap, or rows below the low bound halved or above the high bound doubled)
  • Escalation. escalateAfter: 3 raises the severity one step once the dataset has failed 3 evaluations in a row
  • Watch. Per dataset, all (the default) watches it, high alerts only at high, and none leaves it out
  • History. Rows of ops.dataset_health older than 30 days are removed

Alerts

There is one alert per rule and resource while the condition holds. It opens when the check fails and resolves on its own at the first pass where the check holds again, including when the rule or the resource goes away. If the condition comes back, a new alert opens. Each alert keeps its current value against the threshold and a short series of the measured value, one point at most every five minutes, the last 48

ChangeWhenSent
OpenedThe check fails for a resource with no open alertTo the routes of its severity
EscalatedThe measured severity risesTo the routes of the new severity
LoweredThe measured severity falls while the alert stays openRecorded only
ResolvedThe check holds againWhen sendResolved is true, the default
Snoozed, unsnoozedSomeone snoozes it with a reason and an end time, or lifts the snoozeRecorded and audited
Snooze endedThe end time passes with the alert still openTo the routes again

While an alert is snoozed nothing is sent, and it still resolves on its own. Every change is a row in ops.monitor_events. Resolved alerts and changes are kept 30 days. Alerts, events and windows are on the platform clock

Routes and messages

routes sends each severity to destinations

  • A notification destination by name, email, Slack or Teams from notifications.destinations
  • webhook:<subscription id> for a signed webhook
  • inbox for the in-app inbox of administrators and the monitor groups

Messages are webhook events written to ops.webhook_events and queued in ops.webhook_deliveries, so they go out with the dispatcher's retries, dead letters, templates and mutes. A webhook subscription or notification route that names monitor.* events gets them too. Only administrators and the monitor groups may receive them: a destination's runAs, audience or email recipients are checked as for any event

{
  "type": "monitor.alert.opened",
  "data": {
    "id": "mon_01JB4V…",
    "rule": "pipeline-failing",
    "ruleName": "Pipeline failing",
    "kind": "pipeline",
    "resource": "fleet",
    "resourceName": "Fleet status",
    "severity": "high",
    "state": "open",
    "value": 2,
    "threshold": 2,
    "message": "2 failed builds in a row",
    "runbook": "https://wiki.example/runbooks/pipelines",
    "change": "opened"
  }
}

The event carries the signing headers and envelope described on webhooks; the data fields are shown here

API

EndpointDoes
GET /api/v2/monitors/rulesRules with their open alert counts, routes, groups, problems in the configuration and the timer's last pass
GET /api/v2/monitors/alertsAlerts, highest severity first. state is open (the default), resolved or all, and severity, rule and limit narrow the list
GET /api/v2/monitors/alerts/{id}One alert: its value against the threshold, its series, its changes and recent runs
POST /api/v2/monitors/alerts/{id}:snooze{"reason": "…", "until": "<time>"} or {"reason": "…", "for": "4h"}
POST /api/v2/monitors/alerts/{id}:unsnoozeLifts a snooze
POST /api/v2/monitors:evaluateAdministrators: one pass now, with dataset health

The listing and alert routes are for administrators and the monitor groups; anyone else gets 403 MONITORS_VIEWER_ONLY. Snoozes and passes run by hand are audited as monitor.snoozed, monitor.unsnoozed and monitor.evaluated.

Limitations

  • A rule has one check. Two conditions on the same resource are two rules, each with its own alert
  • Routes are set per severity for the whole ontology. Routes per rule are delivered on request
  • An alert can be snoozed but not acknowledged; acknowledgement and an issue opened automatically for an alert are delivered on request
  • Rules over everything an app depends on, and sync lag against the source system, are delivered on request
  • Paging tools are reached through a signed webhook; direct integrations with them are delivered on request
  • A resource with no runs at all is not quiet, so a new pipeline that does not start raises no quietFor alert

Related