🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Pipeline Observability: SLIs, Alerts, and Incident Response

Data EngineeringPipeline Operations⭐ Premium

Pipeline Observability: SLIs, Alerts, and Incident Response

Difficulty: Senior Level | Companies: Netflix, Uber, Airbnb, Spotify, Stripe

An ETL job that finishes in twenty minutes and writes 4.2 million rows looks perfectly healthy inside the scheduler. The harder question is whether those rows are the right rows, fresh enough for the people waiting on them, and shaped the way downstream consumers were written to expect. Observability in data engineering is the practice of answering those questions from inside the system, continuously, before a stakeholder opens a broken dashboard. This lesson covers the metrics worth measuring, the alert rules derived from them, the tracing you need to locate a fault, and the triage process that turns a page notification into a resolved incident with an owner.

Prerequisites

  • !Batch orchestration with Airflow or Prefect
  • !Basic SQL and an understanding of table partitioning
  • !How Prometheus scrape targets and labels work

What You'll Learn

  • 1Choose freshness, volume, completeness and schema SLIs for a warehouse table
  • 2Express those SLIs as Prometheus alert rules with sensible for-durations
  • 3Attach OpenTelemetry spans to pipeline stages for fast root-cause search
  • 4Classify data incidents by severity and route each one to a named owner

Why green dashboards still ship wrong numbers

A pipeline that exits with status zero tells you the code ran to completion. It does not tell you that a partner changed a CSV column order overnight, that an upstream API silently started returning an empty array, or that a late-arriving partition was written twice and now double-counts revenue. Every one of those failures produces a green checkmark and a corrupt table.

Data observability borrows the vocabulary of application observability but measures different objects. Service teams track latency percentiles and error rates because users feel those directly on a screen. Data teams must track the properties of the artifacts they produce: how fresh each table is, how many rows arrived compared with history, whether required columns are null, and whether the schema still matches the registered contract. Uptime is therefore never a sufficient signal on its own. A warehouse can be fully available and completely wrong at the same time, which is exactly the failure mode that costs trust the fastest.

The five SLIs worth measuring first

Start with a small, deliberately boring set. Freshness compares the newest row timestamp against the schedule the table promised. Volume checks whether the row count for a partition sits inside a normal historical band. Completeness tracks null ratios on columns that are declared required. Uniqueness counts duplicate primary keys. Schema stability compares column names and types against the registered contract. Together these five catch the overwhelming majority of production issues without any machine learning.

Each SLI should collapse into a number between 0 and 1 wherever possible, because a single score is what both executives and on-call engineers can act on. The table below shows how each one is computed and what a breach actually means to the business.

SLIComputationHealthy rangeFailure it catches
FreshnessNewest row time minus expected cadenceWithin one scheduled intervalStalled upstream feed, dead scheduler
VolumePartition rows versus trailing 14-day meanZ-score between minus 3 and 3Empty extract, duplicate load
CompletenessNull count divided by row count per columnUnder 1 percent on required columnsParser drift, optional field dropped
UniquenessDistinct keys divided by total rowsAbove 0.999Replayed batches, missing dedup key
Schema stabilityActual columns versus contract columnsExact match or approved additive changeSilent breaking rename or type change

Alert rules people actually keep enabled

An SLI that nobody alerts on is documentation, not monitoring. The rules below turn the score concepts into concrete Prometheus expressions. Notice the for clauses: a pipeline that runs hourly will naturally look stale for a few minutes, so a rule that fires immediately would page someone for normal behaviour. Requiring the condition to hold for five or ten minutes first is what separates a useful page from noise.

groups:
  - name: data_pipeline_alerts
    rules:
      - alert: DataStale
        expr: data_freshness_minutes{env="prod"} > 120
        for: 10m
        labels:
          severity: critical
        annotations:
          summary: "Table {{ $labels.table_name }} has not refreshed in 2 hours"

      - alert: PipelineFailing
        expr: rate(pipeline_errors_total[15m]) > 0
        for: 5m
        labels:
          severity: warning
        annotations:
          summary: "{{ $labels.pipeline_name }} reporting sustained errors"

      - alert: VolumeAnomaly
        expr: abs(pipeline_rows - avg_over_time(pipeline_rows[14d])) / avg_over_time(pipeline_rows[14d]) > 0.3
        for: 15m
        labels:
          severity: warning
        annotations:
          summary: "Row count for {{ $labels.pipeline_name }} drifted more than 30 percent"

Severity labels matter as much as the expressions. A critical page should wake someone up because revenue or customer-facing data is affected. Everything else belongs in a morning triage queue. If every rule is critical, nothing is.

Instrumenting stages with one decorator

The cheapest instrumentation is the kind engineers do not have to remember. Wrapping each stage in a decorator guarantees that duration, row counts and failures are recorded without any per-task boilerplate. The implementation below uses the Prometheus client, but the shape is identical for StatsD or OpenTelemetry metrics.

python
import time
from functools import wraps
from prometheus_client import Counter, Histogram, Gauge

PIPELINE_DURATION = Histogram(
    "pipeline_duration_seconds", "Pipeline execution duration", ["pipeline_name", "stage"]
)
PIPELINE_ROWS = Counter(
    "pipeline_rows_processed", "Total rows processed", ["pipeline_name", "stage", "status"]
)
PIPELINE_ERRORS = Counter(
    "pipeline_errors_total", "Total pipeline errors", ["pipeline_name", "error_type"]
)
DATA_FRESHNESS = Gauge("data_freshness_minutes", "Data freshness in minutes", ["table_name"])


def monitor_stage(pipeline_name: str, stage: str):
    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            start = time.time()
            try:
                result = func(*args, **kwargs)
                PIPELINE_DURATION.labels(pipeline_name=pipeline_name, stage=stage).observe(
                    time.time() - start
                )
                rows = len(result) if hasattr(result, "__len__") else 1
                PIPELINE_ROWS.labels(pipeline_name=pipeline_name, stage=stage, status="success").inc(rows)
                return result
            except Exception as exc:
                PIPELINE_ERRORS.labels(pipeline_name=pipeline_name, error_type=type(exc).__name__).inc()
                raise
        return wrapper
    return decorator


YESTERDAY = "2026-01-12"


@monitor_stage("daily_sales_etl", "extract")
def extract_orders():
    return client.query(
        "SELECT * FROM raw.orders WHERE updated_at >= :since",
        since=YESTERDAY,
    )

Once metrics exist, add spans so an engineer can move from a firing alert to the exact stage that failed. A trace that carries the pipeline name, the run identifier and the partition date turns a thirty-minute log hunt into a single query.

Triage: turning a page into an owned incident

Alerting without triage just moves the confusion from the dashboard into the chat channel. Assign severity with rules rather than opinions, then attach an owner immediately. The classifier below is intentionally blunt: downstream blast radius overrides the base severity, because a quality warning consumed by forty dashboards is worse than a pipeline failure consumed by none.

python
from dataclasses import dataclass, field
from enum import Enum
import time


class Severity(Enum):
    P1 = "critical"
    P2 = "high"
    P3 = "medium"
    P4 = "low"


SEVERITY_RULES = {
    "PIPELINE_FAILURE": Severity.P1,
    "SCHEMA_CHANGE": Severity.P2,
    "FRESHNESS_BREACH": Severity.P2,
    "VOLUME_DROP": Severity.P2,
    "NULL_SPIKE": Severity.P3,
    "DUPLICATE_ROWS": Severity.P3,
}


@dataclass
class DataIncident:
    incident_id: str
    severity: Severity
    alert_type: str
    table: str
    owner: str
    root_cause: str = "under investigation"
    mitigation: str = "pending"
    opened_at: float = field(default_factory=time.time)


def triage(alert_type: str, context: dict) -> DataIncident:
    severity = SEVERITY_RULES.get(alert_type, Severity.P4)
    if context.get("downstream_count", 0) > 10:
        severity = Severity.P1
    return DataIncident(
        incident_id=f"INC-{int(time.time())}",
        severity=severity,
        alert_type=alert_type,
        table=context.get("table", "unknown"),
        owner=context.get("owner", "data-platform"),
    )

A runbook should sit next to the classifier with three fixed entries: how to confirm the alert is real, how to isolate the upstream partition, and how to trigger a safe backfill. Interviews reward candidates who can state the recovery step, not just the detection step.

Cutting alert noise without going blind

Alert fatigue is the reason most data platforms quietly abandon monitoring. The fix is structural rather than cosmetic. First, separate paging rules from trending rules and route them to different destinations. Second, add anomaly baselines that adapt to weekday and seasonality patterns instead of comparing Monday against Sunday. Third, require an owner tag on every metric so a rule without a team cannot be deployed. Fourth, review firing history monthly and delete rules that never produced an actionable incident, because a rule that fires and is ignored teaches the on-call rotation to ignore the tool.

The final piece is feedback. When an incident closes, record whether detection was automated, whether the runbook helped, and what the true root cause was. Those three fields feed directly back into which SLIs you instrument next. Observability is a loop, not a dashboard you build once and admire.

💡Start narrow

Instrument freshness and volume on your twenty most-consumed tables before anything else. Those two signals surface roughly eighty percent of real production issues, and they are cheap enough that nobody will be tempted to switch them off.

Common Mistakes

Alerting on every schedule tick without a for-duration

Fix: Require the condition to hold for one full cycle so normal lateness never pages anyone

Treating a zero exit code as proof the data is correct

Fix: Gate downstream writes on row count, null ratio and schema checks before publishing

Nobody is named as owner of a metric

Fix: Reject any alert rule that ships without an owner label and a runbook link

Building an executive health score nobody trusts

Fix: Publish the underlying SLI values alongside the score so the number can be audited

Best Practices

  • Keep the SLI set small and stable so trends stay comparable quarter over quarter
  • Attach a runbook URL to every paging alert and verify the link during game days
  • Record detection time, triage time and resolution time for each incident and review them monthly
  • Version alert rules in the same repository as the pipeline so changes are reviewed and reversible
  • Replay a known-bad partition occasionally to prove the alerting path still works

Interview Questions

Q1: How do you distinguish observability from monitoring in a data platform?

Monitoring tells you that a condition occurred, usually a threshold breach. Observability lets you ask why it occurred using correlated metrics, logs, traces and lineage without shipping new code.

Q2: Which SLI would you alert on first for a revenue table?

Freshness, because a stale revenue table is immediately visible to the business and is almost always caused by a small number of upstream failures that are cheap to isolate.

Q3: How do you prevent alert fatigue on a data platform?

Separate paging from trending, use anomaly baselines instead of static thresholds, enforce owner tags, and review firing history monthly to retire rules that never produced action.

Q4: What does a good incident runbook contain?

A confirmation step that proves the alert is real, an isolation step that identifies the bad partition or upstream source, a recovery step such as a backfill command, and a communication template for stakeholders.

Q5: How would you monitor a streaming pipeline differently from a batch pipeline?

Batch uses freshness and volume per partition. Streaming adds consumer lag, checkpoint age, watermark delay and state store size, because those degrade before throughput visibly drops.

Key Takeaways

  • Green schedulers prove execution, not correctness, so quality checks must gate publication
  • Freshness, volume, completeness, uniqueness and schema stability cover most production failures
  • Alert rules need for-durations, severity labels and owners to survive contact with an on-call rotation
  • A stage decorator gives consistent metrics with no per-task boilerplate
  • Triage rules plus a three-step runbook convert alerts into owned, resolvable incidents
  • Review firing history monthly and retire rules that never changed a decision
🔒

Premium Content

Pipeline Observability: SLIs, Alerts, and Incident Response

You've previewed the first section. Unlock this full lesson and 900+ advanced tutorials with a Premium plan.

đŸŽ¯End-to-end Projects
đŸ’ŧInterview Prep
📜Certificates
🤝Community Access

Already a member? Log in

CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-13

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Advertisement