RAG pipelines fail quietly. A parser starts mangling a new document format, an embedding batch half-fails, an upstream schema change drops a source — and no exception fires, because every component "worked".
Tier: Advanced · Workflow area: RAG data pipelines
The symptom shows up weeks later as users losing trust in answers. Data engineers already know the cure: observability on the data, not just the jobs. This playbook instruments the RAG data pipeline the way you instrument any pipeline — freshness SLAs, volume drift, failure-rate metrics — plus the one genuinely new instrument: canary queries that catch retrieval-quality regressions the day they happen.
Instrument the four data-side metric families. Emit these from the pipeline into whatever metrics store the team already uses (warehouse table + dashboard is fine):
now() - max(applied event_ts) (pb-36's lag) and last-successful-run age per stage (parse, embed, sync).Build the canary query set. Take 20–40 golden-set questions (pb-28) with stable, known-correct source documents, plus a few probes per critical source system ("does content from the HR wiki still retrieve at all?"). Store as data, not code:
{"canary_id": "hr-leave-01", "q": "How many privilege leave days accrue per year?",
"expect_doc_id": "hr/leave-policy.md", "k": 10, "source": "hr-wiki"}
Run canaries on a schedule against the live retrieval endpoint. Same entry point users hit (pb-31's shared function), so parser, index, filters, hybrid, and rerank are all inside the test boundary:
def run_canaries(canaries, search):
results = []
for c in canaries:
hits = search(c["q"], k=c["k"])
passed = any(h["doc_id"] == c["expect_doc_id"] for h in hits)
results.append({**c, "passed": passed, "run_at": now_iso()})
return results # persist to canary_runs table
The headline metric: canary pass rate (recall@10 over the canary set), tracked per run. Expected steady state: a flat line at your launch eval level (e.g. 92–97%). Alert on a drop of more than ~5 points sustained over two consecutive runs, and on any per-source probe going to zero — that is a whole source silently vanished.
Make alerts diagnostic, not just loud. A canary failure plus which other metrics moved localizes the fault: pass-rate drop + chunk-count spike → chunking/parser change; drop confined to one source + freshness lag on that source → sync failure; drop after a deploy + no data metrics moved → retrieval code regression. Encode this triage table in the runbook next to the alert.
Wire it into the existing stack — do not build a parallel one. Airflow/Dagster SLAs and sensors own freshness alerts; dbt-native observability (Elementary) or your data-observability platform (Monte Carlo class) owns volume/drift on the chunk tables; traces from Langfuse or Phoenix cover per-query retrieval latency and scores. The canary runner is one small scheduled job writing to one table that all of them can read.
Review drift monthly, not just alerts daily. Slow decay — canary pass rate sliding 1 point a month as corpus composition shifts — never trips a threshold. A monthly look at the trend lines, plus refreshing canaries when documents legitimately change (a canary failing because its gold document was correctly updated is maintenance, not regression), keeps the monitor honest.
Canary queries are to RAG what row-count checks are to ELT — trivially cheap, embarrassingly effective, and mostly valuable because they run every day, not because any single run is clever.
Monitoring artifacts leak content in small ways — canary questions quote client documents, and failure alerts may embed retrieved text — so keep the canary set, run history, and dashboards inside the client boundary, and strip retrieved-passage payloads from anything that pages an external on-call channel (alert with IDs and metrics, never chunk text). The fault-injection drill doubles as a strong client deliverable: a recorded demonstration that stale-index and lost-source failures are detected within SLA is precisely the operational-readiness evidence their platform review wants, and it can be run entirely on synthetic canary documents seeded for that purpose.