Data Observability and Data Contracts

Monitor freshness, volume, schema and distribution automatically, and agree data contracts with producers so upstream changes stop breaking pipelines.

Advanced · about 4 hours · difficulty 3/5

Learn first: Testing with dbt

Tests check what you thought of. Observability watches for what you did not, and contracts stop many problems at the source.

Data observability

Monitor every important table for:

  • Freshness: when was it last updated?
  • Volume: did today's row count drop by 40 percent?
  • Schema: did columns appear, disappear or change type?
  • Distribution: did the share of null cities or the average order value shift sharply?
  • Lineage: what is affected downstream when something breaks?

Tools range from commercial platforms (Monte Carlo and others) to open source options (Elementary for dbt, custom SQL monitors plus alerts). Start simple: a daily job computing row counts and freshness with thresholds.

Data contracts

A data contract is an agreement between a data producer (often a backend team) and consumers:

  • Schema with types, required fields and meaning.
  • Quality expectations and SLAs (delivered by 6 a.m., no null order_id).
  • Ownership and a change process (breaking changes need notice and versioning).

Enforce contracts with schema registries for events, dbt model contracts for tables and CI checks in producer repositories.

Pipeline SLAs and on-call

Define SLAs for critical datasets, alert the owning team, write runbooks, and run blameless post-mortems after incidents.

Pitfalls

  • Alerting on everything so the team mutes the channel.
  • Contracts written in a document nobody enforces.

You are ready to move on when you have a daily monitor that alerts on freshness and volume anomalies for your key tables, and a written contract for one source with an enforcement mechanism.

Key concepts

  • Freshness and volume monitoring
  • Schema change detection
  • Distribution anomalies
  • Data contracts
  • dbt model contracts
  • Elementary for dbt
  • SLAs, runbooks, post-mortems

Mini project

Build a small observability job that records daily row counts and max timestamps for five tables, flags anomalies beyond a threshold, and posts to a Slack or Discord webhook. Write a one-page data contract for your orders source.

Check yourself

A backend team renames a column and your pipeline loads nulls for three days. Which practice would have prevented this, and which would have detected it sooner?

Free resources