What Telemetry Is Worth Keeping

Concepts covered: 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

QuestionSignal that answers itWho acts on it
Is the output late or wrong right now?Freshness and row-count checks on the final tablesOn-call engineer, from an alert
Which task in which run failed, and why?Task logs that carry `run_id`, plus task statusOn-call engineer, while debugging
Is this pipeline getting slower or more expensive?Daily rollups of duration and cost per taskOwning 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 queueAlmost 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.

SignalFull detail keptAfter thatWhy this window
Task logs14 daysError lines kept 90 days, the rest deletedIncidents are debugged within a week; repeat errors show up over a quarter
Task metrics at 10-second points15 days5-minute rollups kept 13 months13 months lets you compare a month with the same month last year
Run tracesEvery failed run and 5% of successful runs, for 7 daysDeletedFailures need the full path; latency trends need only a sample
Query cost records13 monthsDeletedSmall 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?

About this lesson

This section is part of the Pipeline Operations: Intermediate lesson on DataDriven, the home of data engineering. Lessons cover SQL, Python, Spark, data modeling and pipeline architecture, and each section pairs its explanation with worked examples and practice you run as you go.