Freshness and volume health

A point-of-sale feed that stops at 10:02 on a busy Saturday should raise a flag on its own, without anyone having written "the city shop sends something every 20 minutes before noon on weekends". Dataset health learns that from each dataset's own history: when data normally arrives and how many rows it normally brings, per shop, line or site. It then shows a health dot wherever the dataset appears and alerts its owner when a slice is late, missing or out of its usual range

LearnedFrom the last 4 weeks of the dataset's own commits
SlicedPer value of one column, such as shop, up to 200 slices
EvaluatedOn a new version or a missed update, every 15 minutes at most and every hour at least
AdvisoryFlags and alerts; never blocks a build

In the platform today

Built
  • Dataset health runs in the platform service with tests
  • It watches every lake table, raw, gold and object tables, and takes its settings from ontology.yaml under health:, with window (28 days by default), grace and, per dataset under datasets:, timestamp, bucket, sliceBy, volume (rows or added), sensitivity and exclude (a where filter, named slices, or slices whose objectType matches a condition)
  • Update times come from pipeline builds, syncs, the timestamp column or Delta commits; the next update is expected within the usual gap plus the grace period, and the row range is the usual range widened by the sensitivity
  • The built states are On time, Late, Low volume, High volume, Learning and Excluded, and a sliced dataset shows its worst slice
  • Evaluation runs on a timer whenever a monitor rule watches datasets, for each dataset with a new version or past its expected update time
  • It also runs with POST /api/v2/health/datasets/evaluate and on the first read
  • Every evaluation is written to ops.dataset_health, kept 30 days; GET /api/v2/health/datasets and GET /api/v2/health/datasets/{name} read it
  • A late, low or high dataset opens a monitor alert, which escalates after repeated failures, resolves on its own and is sent by severity to email, Slack, Teams, a signed webhook or the inbox, as described in alerts
On request
  • The settings file, the scheduled and continuous shapes, the 5-minute schedule, issues with quiet hours, the CLI and the metric on this page
Requirements
  • The Owner role on the dataset to switch health on and tune it. Viewers of the dataset see its health
  • At least 14 days of history for the dataset, either already in its Delta log or accumulated after switching on
  • A column holding the source's own time, such as _ms_source_ts on raw datasets, is strongly recommended
  • No extra access labels. Slice values of a dataset with access labels are shown only to people who hold its access labels

What health learns

Health learns each feed's normal rhythm from its own history. It reads commit metadata rather than scanning rows, so it costs little to run, even on large raw datasets. For every slice it learns two things: when data should arrive, and how many rows a normal update has

SHP-HFX day-close file, Saturdays Scheduledarrival time expected by 05:30 today 06:10, late last 4 Saturdays 04:0005:0006:0007:0008:00 SHP-HFX inventory changes, Saturday morning Continuousquiet gaps late missing last 10:02resumes 11:20 09:0010:0011:0012:0013:00
The same shop, two feeds, two shapes. A scheduled feed is judged on when it arrives; a continuous feed on how long it has been quiet compared with the same hour on comparable days

Scheduled and continuous feeds

A feed that arrives at set times, like a nightly ERP extract or a shop's day-close file, is judged on when it arrives. A feed that updates all day, like a stream of inventory changes, is judged on how long it has been quiet compared with the same hour on comparable days. A grace period, which can be set per dataset, absorbs small delays

Expected row range

Health also learns how many rows a normal update adds or changes, and flags one well outside that range. The sensitivity setting decides how far outside counts. A day-close file of 9 rows from a shop that normally sends 40 to 180 is low volume. One of 2,400 rows, usually a replayed or duplicated extract, is high volume

The learning window

Expectations come from a rolling window, 28 days by default, so they follow gradual change without anyone retuning them, and a Saturday is judged against Saturdays. Days or hours covered by an exclusion are left out of learning as well as out of evaluation

Slices

A slice is one value of a column you choose, such as location_id on the point-of-sale feed or line on the production run feed, raw.plant_runs. Each slice gets its own expectations, which matters because fourteen shops do not trade alike: the city shop sells all day in August, while another is busiest at 21:00 in term. A dataset can have one slice column and up to 200 slices. A new value starts in Learning while the dataset-level check still covers it. Mapping the slice column to an object type, for example location_id to Scoop shop, is what lets the Operations view show the dot on the shop itself

Health states

Each slice and check has one state at a time. A dataset's dot shows its worst slice, with a count, such as "3 of 14 shops late"

StateDotMeaningClears when
learningGrey outlineNot enough history yet for the sliceEnough history accumulates
healthyGreenData arrived when expected, with rows in rangeNot applicable
lateAmberPast the expected arrival with no new dataData arrives
low_volumeAmberData arrived with fewer rows than the expected rangeThe next arrival is in range
high_volumeAmberData arrived with more rows than the expected rangeThe next arrival is in range
excludedGreyAn exclusion applies now, so nothing is expectedThe exclusion ends

Where the dot shows

  • Data, then Catalogue. The dataset list has a health column. Each dataset's Health tab lists every slice with its state, expected arrival, last arrival and row range, a 28-day strip of arrivals, and the reason for any exclusion. A late slice reads, for example, "expected by 05:30, last 06:10"
  • Lineage. Each dataset node in lineage carries its dot, and every downstream node of a late or missing dataset gets an "upstream late" ring. A backing dataset that built on time from a raw dataset that did not is therefore visibly stale, not quietly current
  • Operations view. When a slice column is mapped to an object type, the object shows its slice's state. The city shop's card reads "Sales feed late · expected by 10:30, last 10:02", and properties backed by that feed show their age. A planner then knows the stock figure is two hours old before acting on it
Late is not the same as stale

The freshness stamp on an object, from indexing and sync, says how old the data is. The health dot says whether that age is normal. A day-close file that is 20 hours old at 04:00 is healthy; the same age at 06:30 is not

Switch it on and tune it

Health is set in ontology.yaml under health:, with the learning window and grace period, and per dataset the timestamp column, slice column, volume measure, sensitivity and exclusions. Start sensitivity at normal; lower it for feeds that swing with the weather, such as summer sales, and raise it for feeds that are steady and critical, such as silo levels

health:
  window: 28d
  grace: 10m
  datasets:
    raw.pos_inventory_moves:
      # source time, not the time the connector copied it
      timestamp: _ms_source_ts
      sliceBy: location_id
      volume: added
      sensitivity: low                         # sales swing with the weather
      exclude:
        - { slices: [L11], reason: Closed for the winter }

On request, a settings file per pipeline, fixed arrival times per slice and a CLI that checks the file before it merges

Exclusions

Most false alarms come from periods when silence is correct. An exclusion says that nothing is expected during a period, so a slice shows excluded instead of late, and the period is not learned from, so a closed Christmas Day does not teach health that quiet Thursdays are normal

KindExampleUse for
where{ where: "status = 'Closed'", reason: Shop closed }Rows that mean no data is due, as a predicate on the dataset
slices{ slices: [L11], reason: Closed for the winter }Named slices, such as a seasonal shop that closes for the winter
objectType{ objectType: shop, where: { status: Closed } }Slices whose object's state means no data, such as a closed shop or a line down for maintenance

On request, calendars, one-off windows and past incidents left out of learning

Alerts

In the platform service today, alerts on dataset health come from a monitor rule with scope: dataset

monitors:
  routes: { high: [ops-email, inbox], medium: [inbox], low: [] }
  health: { every: 1h, minGap: 15m }
  rules:
    - id: datasets-health
      name: Feeds late or out of range
      scope: dataset
      check: { health: [late, low, high], highFactor: 2, escalateAfter: 3 }
      watch: { raw.pm_events: high, gold.notes: none }
      severity: medium

One alert opens per dataset while it is late, low or high, at the rule's severity, or at high when it is also outside bounds highFactor times looser, such as late by twice the allowed gap. After escalateAfter failing evaluations in a row it rises one step. watch sets per dataset whether it is watched at all, at high only, or not. The alert resolves on its own at the first evaluation where the dataset is healthy again, and webhook events monitor.alert.opened, .escalated and .resolved carry it

On request, one issue per dataset and check covering every slice, with quiet hours, and a health metric for your own monitoring tools

Verify it works

After adding a dataset, run an evaluation with POST /api/v2/health/datasets/evaluate, check that the learned expectations look right with GET /api/v2/health/datasets/{name}, which lists every slice with its state, and confirm that evaluations are recorded in ops.dataset_health, which receives a row for the dataset and each slice at every evaluation

-- Latest state of every slice of the point-of-sale feed
SELECT slice, state, freshness, volume, last_update, expected_by,
       rows_now, rows_low, rows_high, note
FROM ops.dataset_health
WHERE dataset = 'raw.pos_inventory_moves'
  AND evaluated_at = (SELECT max(evaluated_at) FROM ops.dataset_health
                      WHERE dataset = 'raw.pos_inventory_moves')
ORDER BY state, slice;

A slice stays in Learning until the window holds enough of its updates to learn from

Health and data quality checks

Health and checks answer different questions, and most datasets that matter should have both. Checks are rules you write: this key is unique, this temperature is below 4 °C, this feed is never older than 20 minutes. Health is behaviour learned: this shop usually sends something every 20 minutes on a Saturday morning, and about 60 to 240 rows an hour

ChecksDataset health
Who sets the barYou, in pipelines.yamlThe dataset's own last 4 weeks
What it checksValues, keys, schema and row counts you specifyArrival time and row volume only
GranularityRows or the whole datasetEach slice, such as each shop
When it runsOn every build, before it publishesOn a timer while a monitor watches datasets, on request and on first read, including raw datasets with no build
EffectCan fail a build or drop rows to quarantineNever blocks; shows a dot and alerts
Best forInvariants that must holdPatterns too varied to write down: 14 shops times 7 days times 24 hours
Resultsops.quality_resultsops.dataset_health

A good split for the creamery: fail on keys and impossible values with checks, and let health watch when each feed arrives and how much it brings

Limitations

  • A slice needs 14 days of usable history before it is evaluated, and 28 days for full weekday patterns
  • Only weekly patterns are learned. Seasonal change, such as summer trading giving way to autumn hours, is relearned over two to four weeks, during which alerts can misfire. Use exclusions for known changes
  • A real change in pattern, such as a new extract time, keeps alerting until it is learned. Use Relearn from a date on the Health tab to discard the old pattern
  • Health checks arrival and volume, not values. A feed that arrives on time with wrong numbers is healthy; that is what checks are for
  • Without a source timestamp column, health judges arrival by commit time, so a connector that replays old rows looks fresh
  • One slice column per dataset, and up to 200 slices. Datasets with more distinct values are evaluated as a whole
  • When a monitor watches datasets, health is evaluated when one has a new version or passes its expected update time, at most every 15 minutes (health.minGap) and at least every hour (health.every), so a late state can appear up to 15 minutes after the expected time
  • Health never blocks a build, pauses a sync or stops an automation

Related