Observability Case Study
See inside every call.
A full observability layer over a production RAG system: every query traced into retrieval, reranking, and generation time, with Grafana dashboards and CI gates that block a deploy before it degrades quality.
Debugging a RAG pipeline blind.
Attribution
A single end-to-end latency number doesn't say whether retrieval, reranking, or generation caused a slowdown.
Cost
Without per-query cost tracking, a prompt or model change could quietly inflate spend before anyone noticed.
Regression
Nothing stopped a change that degraded answer quality from reaching production before a human noticed.
How a query gets observed.
End-to-end spans
Langfuse instruments every request into retrieval, reranking, and generation spans with their own timing.
Prometheus export
Latency, cost, and quality metrics scraped from the FastAPI service on every request.
Grafana
Tracks p50/p95 latency, token cost per query, and quality scores over time.
Regression check
A GitHub Actions check blocks a deploy when latency spikes or a quality score drops.
Four engineering decisions, up close.
Span-level, not request-level.
Langfuse spans wrap each pipeline stage individually, so a latency spike can be attributed to retrieval versus generation instead of guessed at.
One place for latency, cost, and quality.
Grafana panels pull from the same Prometheus metrics store, so latency percentiles, token cost, and quality scores live side by side.
The pipeline fails closed.
A GitHub Actions job runs the evaluation suite on every change; a regression in latency or quality score fails the check instead of shipping silently.
Instrumented at the FastAPI layer.
Metrics are emitted directly from the serving layer, so the dashboards reflect real production traffic, not a synthetic sample.
What became visible.
Pipeline stages traced individually
What this layer doesn't do yet.
No alerting yet
Dashboards surface regressions visually; there's no paging or Slack alert wired up for on-call response.
Single-service scope
Tracing covers the RAG service itself, not every upstream or downstream dependency.
Fixed evaluation thresholds
The CI quality gate uses static thresholds rather than statistical drift detection.
Wire Grafana alert rules into Slack or PagerDuty for real-time incident response.
Replace static thresholds with statistical drift detection on quality scores over time.