Pipeline Operations: Intermediate
Say a pull request at Netflix changes watch_time in a playback table from seconds to minutes on a Monday. A forward lineage walk names the 140 downstream tables and dashboards and their owners, and a data diff in CI shows every row's watch_time divided by 60 before merge. Those steps keep Tuesday's Top 10 built on real viewing numbers, and this lesson works them on a small orders pipeline.
Start from the question, then pick the signal
| Question | Signal that answers it | Who acts on it |
|---|---|---|
| Is the output late or wrong right now? | Freshness and row-count checks on the final tables | On-call engineer, from an alert |
| Which task in which run failed, and why? | Task logs that carry `run_id`, plus task status | On-call engineer, while debugging |
| Is this pipeline getting slower or more expensive? | Daily rollups of duration and cost per task | Owning team, at a monthly review |
| What did row 8,812,004 look like inside step 3? | No telemetry; query the table or the dead letter queue | Almost nobody, almost never |
The last row is where budgets leak. A task that logs every row of a 200-million-row load writes 200 million lines per run; at 300 bytes a line, that is 60GB of logs a day from 1 task, and the line for row 8,812,004 will never be read. Log once per batch instead: the run_id and the duration, and how many rows came in and went out, with rejected rows counted separately. Those few lines per run answer the second question in the table.
Cardinality decides the metric bill
A metrics store keeps 1 time series per unique combination of label values. Storage cost grows with the series count, and so does query cost. With pipeline and task as its labels, the metric rows_written makes 480 series over 40 pipelines of 12 tasks each. That is cheap, and it is enough to see which pipeline and task slowed down or shrank. Add a customer_id label, which has 50,000 distinct values, and each of those series splits 50,000 ways.
A label belongs on a metric when its set of values grows with the platform, such as pipeline and task, or env and status. Values that grow with the data go into log lines, where they leave no permanent series behind; customer_id and order_id are examples, as are run_id and partition_date. run_id looks harmless, but as a label it mints a new series every run, each holding the points of a single run.
Keep detail briefly, keep summaries for 13 months
Questions about raw detail come within days of an incident. Questions about trends, such as whether orders_daily has slowed since spring, come months later. Retention is therefore tiered: full detail for a short window, then downsampled rollups for a long one.
| Signal | Full detail kept | After that | Why this window |
|---|---|---|---|
| Task logs | 14 days | Error lines kept 90 days, the rest deleted | Incidents are debugged within a week; repeat errors show up over a quarter |
| Task metrics at 10-second points | 15 days | 5-minute rollups kept 13 months | 13 months lets you compare a month with the same month last year |
| Run traces | Every failed run and 5% of successful runs, for 7 days | Deleted | Failures need the full path; latency trends need only a sample |
| Query cost records | 13 months | Deleted | Small rows that feed the monthly cost review |
A teammate proposes adding order_id as a label on the rows_rejected metric so on-call can see which orders failed validation. The pipeline rejects roughly 2,000 of its 400,000 daily orders, each with a new order_id. What should the review say?
- From a node to everything it reads, then everything those read
- Answers: where could this bad number have come from?
- Used during an incident to find the origin
- From a node to everything that reads it, and onward
- Answers: what breaks if this node changes or goes bad?
- Used before a change and during an incident to size the damage
The orders_daily graph
Arrows point from the dataset that is read to the dataset or consumer built from it.
Blast radius is the set of nodes forward of a change or a failure, together with the people who own them. Walking forward from stg_payments reaches 6 nodes. Half of them are the revenue and refunds dashboards and the churn model; the rest are the internal tables fct_orders and agg_daily_revenue, plus customer_ltv. The count alone misleads, so weight each node by who depends on it: the revenue dashboard that Finance closes the month with outranks 3 internal tables.
Column-level lineage narrows the radius
Table-level lineage says fct_orders reads stg_payments. Column-level lineage says which columns feed which: fct_orders.net_revenue is computed from stg_payments.fee_usd, and of the nodes after fct_orders only agg_daily_revenue reads net_revenue. A change to how fee_usd is rounded therefore alters values in fct_orders and agg_daily_revenue and on the revenue dashboard, 3 nodes in all, and the refunds and churn owners need no warning. Renaming or dropping fee_usd is different, because the build of fct_orders fails, everything after it goes stale, and the radius is back to all 6.
Where lineage comes from
| Capture method | How it works | What it misses |
|---|---|---|
| Parse pipeline code | Read each task's SQL and record the tables in its `FROM` and `JOIN` clauses | Dashboards, notebooks and ad hoc queries that read tables directly |
| Parse query logs | Read every query the warehouse ran over a window, from any client | Readers that did not run during the window |
| Declared task inputs and outputs | Each orchestrator task lists what it reads and writes | Anything someone forgot to declare |
Code parsing alone never sees the analyst whose notebook reads fct_orders every Monday, and that analyst is the person who gets surprised. Merging code lineage with 30 days of query logs covers most real readers; declared inputs fill the gaps where SQL is assembled at runtime and cannot be parsed.
Root cause: walk back until the inputs are healthy
| Node | Rows for 2026-10-20 | 7-day average | Status |
|---|---|---|---|
| fct_orders | 255,000 | 410,000 | Low |
| stg_payments | 254,600 | 408,900 | Low |
| stg_orders | 411,200 | 409,800 | Normal |
| raw.payments | 409,700 | 408,300 | Normal |
| raw.orders | 411,500 | 410,100 | Normal |
The origin is the most upstream node that is unhealthy while every node it reads is healthy. fct_orders is low, but stg_payments, one of its inputs, is also low, so the fault entered earlier. stg_payments is low while its only input, raw.payments, is normal: the rows disappeared inside stg_payments. Its last deploy on 2026-10-19 added WHERE currency = 'USD'. A payment processor onboarded that week sends 'usd' in lowercase. The fix lands in stg_payments, and the backfill rebuilds it and every node forward of it, in lineage order.
A Monday alert says customer_ltv has 0 rows for 2026-10-25. Every node upstream of it, from fct_orders back to both raw tables, has normal row counts for that date. Which reading of the lineage is correct?
A warehouse bill reports daily spend for each account and compute cluster. It cannot say that orders_daily cost $4,200 last month, because the warehouse has no idea what a pipeline is. Cost attribution supplies that idea: every query a pipeline sends carries a tag naming who sent it, and the warehouse's query log turns into a ledger you can group by pipeline and then break down by task or by run.
What goes in a query tag
Each field has a job. pipeline and task are the grouping keys for the rollup. run_id ties a query's cost to 1 run and to that run's logs; it is safe here because the query log stores 1 row per query and mints no metric series. owner says whom to talk to. env keeps CI and development spend out of the production numbers.
The rollup
| pipeline | 30-day cost | runs | cost per run | prior 30 days, cost per run | readers in 30 days |
|---|---|---|---|---|---|
| clickstream_sessions | $11,800 | 720 | $16.39 | $16.10 | 3 |
| marketing_attribution | $6,900 | 30 | $230 | $228 | 0 |
| orders_daily | $4,200 | 30 | $140 | $60 | 9 |
| untagged | $3,000 | 0 | n/a | n/a | n/a |
| inventory_snapshot | $2,100 | 30 | $70 | $69 | 5 |
Reading it for savings
- No readersmarketing_attributionIt spends $6,900 a month on tables nobody queried in 30 days. Ask the owner what still depends on them before pausing the schedule.
- Cost per run jumpedorders_dailySame cadence, cost per run up from $60 to $140. Something in the code changed, often a deploy that swapped an incremental load for a full rebuild.
- Cadence above needclickstream_sessionsIt makes 720 hourly runs for 3 readers. If each run reprocesses the whole day so far and readers look once each morning, a daily run removes most of the repeated work.
- Untagged spendthe untagged rowFind who sends untagged queries first. The $3,000 here exceeds inventory_snapshot's whole month, enough to hide a pipeline that size; a working threshold, such as 5% of spend, says when to chase it.
Rank these by expected saving, then by the risk of acting. Pausing an unread pipeline saves the most here and comes undone in a minute. The orders_daily jump is smaller in dollars, but it is a defect that keeps billing until someone finds it, and the run_id in every tag leads to the first expensive run. The steady pipelines can wait.
The team has 1 afternoon for orders_daily, whose cost per run rose from $60 to $140 starting with the first run after a deploy on 2026-09-24. Which next step uses the attribution data most directly?
4 layers, cheapest first
| Layer | What runs | What it catches | Rough time |
|---|---|---|---|
| 1. Static | Parse every SQL file, load every DAG, lint, check for cycles and missing references | Syntax errors, broken imports, a task reading a table that no longer exists | Under 1 minute |
| 2. Unit | Transform logic on hand-written fixture rows with expected outputs | Wrong dedupe or join logic, mishandled nulls and edge cases | 1 to 2 minutes |
| 3. Integration | Build changed tables in a CI schema from 1 recent day of prod inputs, then run the quality checks prod runs | Row explosions, failed uniqueness, nulls in required columns | 3 to 10 minutes |
| 4. Data diff | Compare the CI output with prod output for the same day | Silent changes: rows gained or lost, amounts that moved | 1 to 5 minutes |
Layer 2: a unit test on fixture rows
The fixture holds 3 rows built around the case that matters: 2 versions of order 7. A useful next fixture is 2 versions with the same updated_at, which the function resolves by keeping whichever arrived first. The test needs no warehouse and runs in milliseconds, so it runs on every push.
Layer 4: a data diff against prod
For a pure refactor, every count should be 0. For the lowercase 'usd' fix from the lineage example, diffing 2026-10-20 against the broken prod output should show around 155,000 rows in new_in_ci and nothing missing or changed. That number is the evidence the fix restores the lost payments and touches nothing else.
Slim CI: build only what the change touches
Slim CI uses lineage to choose the build set, which is the tables a pull request modified plus every table downstream of them. Unmodified upstream tables are read from prod instead of rebuilt. In a project of 600 tables, a pull request that edits stg_payments builds 4 tables, stg_payments and fct_orders as well as agg_daily_revenue and customer_ltv; the dashboards and the churn model sit outside the project and stay as they are.
- ▸Reading upstream tables from a stale prod state tests against old data; refresh that state before each CI run.
- ▸A change to shared code or config, such as a common SQL snippet or a currency list, must mark every table that uses it as modified.
- ▸A full build on the main branch each night catches whatever slim selection skipped during the day.
CD: ship the artifact you tested
Deployment promotes the exact code that passed CI to prod on merge, with no rebuild in between. A backfill for changed values runs in forward-lineage order, so each table is rebuilt only from inputs already on the new logic. Order alone leaves a window: until agg_daily_revenue is rebuilt, the refunds dashboard shows new values and the revenue dashboard old ones. Building the affected partitions in a separate schema and swapping them in together closes it.
A pull request that edits fct_orders is described as 'refactor, no behavior change'. Its data diff reports missing_in_ci = 0, new_in_ci = 0 and amount_changed = 18,400. What should the reviewer conclude?
Take orders_daily as it stood before this lesson: 6 tasks on a daily schedule, failure emails to a shared inbox, no metrics or lineage, and no tags or CI. Instrumenting all of it in 1 project takes a quarter and pays nothing until the end. Sequencing it so each step works on its own gives the team a better pipeline every week, and a point to stop at whenever priorities shift.
7 steps, each useful alone
| Week | Step | Value on its own | Builds on |
|---|---|---|---|
| 1 | Freshness and row-count check on `agg_daily_revenue` at 07:00 UTC, paging the owner | The team hears about a late or short load before Finance's 08:00 UTC review | Nothing |
| 2 | `run_id` on every log line from every task | A single search returns a failed run's whole story | The week 1 page links to the run |
| 3 | Duration and row metrics per task, labelled `pipeline` and `task` | Shows which task slowed down or shrank, and since when | `run_id` links a metric spike to the run's logs |
| 4 | Quality gates at the `stg_payments` and `stg_orders` boundaries | Bad batches stop before they reach `fct_orders` | Week 3 metrics: block below 50% of the trailing average, tighten after a few weeks |
| 5 | Lineage from parsed code and 30 days of query logs | Every page names the downstream nodes and their owners | Week 1 pages now carry the blast radius |
| 6 | Query tags on every task | Cost per run and per task on the monthly rollup | Week 2 `run_id` joins a costly query to its run's logs |
| 7 | Slim CI with the 4 test layers | Broken changes stop at the pull request | Week 5 lineage picks the build set; week 4 gates run in layer 3 |
orders_daily after week 7. Every task sends tagged queries and logs with the run's run_id; the gate holds bad staging batches, and the final task carries Finance's freshness promise.
- Ship each step to prod before starting the next
- Alert on the output table first and on task failures second
- Reuse run_id as the key that joins logs to tags, and to pages too
- Set gate thresholds from the metric history you already collect
- Start with CI on a pipeline whose failures nobody sees
- Label metrics with run_id or order_id, or with partition_date
- Rely on engineers to type query tags by hand in each task
- Roll out all 7 steps as 1 change at the end of the quarter
- ▸If the bill is the complaint, start with query tags:
pipelineandtaskwork alone, andrun_idcan join later. - ▸When detection already works and deploys cause most incidents, CI moves earlier: start with layers 1 and 2.
- ▸If lineage shows the pipeline has no readers, ask whether it should run at all before instrumenting it.
Another team asks for help instrumenting clickstream_sessions, the $11,800-a-month hourly pipeline with 3 readers. Failures are rare; the bill is the complaint. Which first 2 steps fit?
Practice across all 5 sections
In week 9 the 07:00 UTC check pages: agg_daily_revenue has no partition for 2026-10-23. The page links run orders_daily__2026-10-23T06:00. The staging gate passed, and logs show build_fct_orders still running at 50 minutes, against the 12 its duration metric shows on a normal day. Its tagged queries have already cost 3 times a normal run, and the only change since the last good run is a merge on 2026-10-22. Which response uses the instrumentation best?
> On a Monday at a ride-hailing company, the driver payouts dashboard shows weekend earnings 12% below normal, and the same week Finance asks why warehouse spend rose by a fifth. The payouts pipeline already has a freshness page, run_id on every log line, task metrics labelled by pipeline and task, lineage from code and query logs, query tags and slim CI.
run_id of that table's run leads to its logs and, through the query tags, to what the same run cost.task shows whether the spend rise and the short table trace back to the same deploy.run_id included, belong in logs.Keep telemetry that earns its cost, trace incidents through lineage, price each pipeline, and test before you ship.
- Category
- Pipeline Architecture
- Difficulty
- intermediate
- Duration
- 32 minutes
- Challenges
- 12 hands-on challenges
Topics covered: What Telemetry Is Worth Keeping, Lineage and Blast Radius, Cost Attribution, CI/CD for Pipelines, Instrumenting a Pipeline E2E
Lesson Sections
- What Telemetry Is Worth Keeping (concepts: Pipeline Monitoring)
Every log line is paid for in 3 places, and so is every metric series and trace span. Ingest and storage are the first 2; the third is each query that reads it. It is paid for again in attention, because a dashboard of 60 panels hides the 3 that matter during an incident. Telemetry is worth keeping when it answers a question that someone acts on, and the table below applies that test to each signal. Start from the question, then pick the signal Cardinality decides the metric bill Keep detail bri
- Lineage and Blast Radius (concepts: Dependency Management)
Lineage is the graph of which datasets are built from which. The nodes are tables and models, plus the dashboards that read them, and each edge records that 1 node reads another. The same graph answers 2 different questions depending on the direction you walk it. The orders_daily graph Column-level lineage narrows the radius Where lineage comes from Root cause: walk back until the inputs are healthy On the morning of 2026-10-21, Finance reports the revenue dashboard showing 2026-10-20 revenue 38
- Cost Attribution (concepts: Pipeline Monitoring)
What goes in a query tag Many warehouses let a client attach a tag or label to its session and record it on each query in the log. Set the tag in 1 place, the orchestrator's task wrapper or the shared database client, so every task inherits it. A hand-typed tag is missing from the first query someone writes in a hurry, which lands in the untagged bucket. The rollup Joined with lineage, the rollup gains its most useful column: how many distinct users and dashboards queried the pipeline's output t
- CI/CD for Pipelines (concepts: CI/CD for Pipelines)
A pipeline change can pass every compile check and still double the rows or drop a filter. It can also change what a column means. CI for pipelines therefore tests the data a change produces as well as the code. The constraint is time: a CI run that takes most of an hour gets skipped, batched into pull requests too large to review, or merged around. 4 layers, cheapest first Each layer catches failures the one before it cannot see. Static checks know nothing about data. Unit tests prove logic on
- Instrumenting a Pipeline E2E (concepts: Pipeline Monitoring)
7 steps, each useful alone The order follows the questions an incident raises: is something wrong, where, who is affected, what is it costing, and how do we stop the next one. Detection goes first because every later step assumes the team knows a failure happened. CI comes last here even though it prevents incidents, because slim selection needs lineage and layer 3 needs the gates. Practice across all 5 sections