Feature flags lab
Instrument metrics and rollout decisions
Metrics for flag_exposure_pct and citation_delta_v2_vs_v1 must distinguish bad input from component failure for release captain flipping rag_index_v2 for cohort canary.
1Try it yourself
Decision drill
Feature flag lab
Flags control who sees what — without redeploying code.
1/3New RAG index for 5% of traffic.
2Learn the idea
Read
Golden signals for this system
Instrument FastAPI RAG endpoint whose v2 index is dark-launched then exposed to 5% so release captain flipping rag_index_v2 for cohort canary can answer: demand, errors, latency/age, saturation. Emit fields needed by flag_exposure_pct and citation_delta_v2_vs_v1 with bounded labels. Sample successful high-volume traces; keep errors and rollout transitions denser within policy.
Read
Alert path worth paging
Define at least one alert that would fire for FLAG-CLIENT-TRUST-4, with a for/pending window that survives deploy blips. Missing scrape or missing revision labels must not look like health. Include a trace/log example id format you will actually search.
Read
Implementation artifact
emit("flag_decision", flag="rag_index_v2", on=bool(on), tenant=ctx.tenant)
Read
Tests for telemetry
Add a unit/integration check that metrics increment on the happy path and on the browser-exposed flag lets attackers force v2 (unreviewed) index branch. Store machine-readable output in CI artifacts when practical.
Read
Stage depth
Cardinality discipline: tenant and revision are usually enough; raw question text is not a label. Exemplars or trace links beat screenshots alone when debugging FLAG-CLIENT-TRUST-4. Define who owns alert fatigue review. If you export to a vendor, record retention and access. Synthetic probes should use non-sensitive fixtures and still exercise POST /v1/rag/answer. Practice the query you will type at 2am once, while calm.
Read
Field notes for `feature-flags-lab` / `observability`
Document the exact PromQL or log query in the runbook stub for this service. Verify histograms have buckets around your SLO target. Add a canary synthetic check that exercises the oracle path every few minutes in staging. Confirm that PII redaction happens before export. Track build/version as a label on the golden signals. Delete noisy debug logs before they become accidental product dependencies. In this chapter the product is FastAPI RAG endpoint whose v2 index is dark-launched then exposed to 5%, the human stakeholder is release captain flipping rag_index_v2 for cohort canary, and the incident id you design against is FLAG-CLIENT-TRUST-4. Re-state the oracle in your notes — 5% cohort sees index_v2 citations; kill switch returns everyone to v1 in < 60s — and keep the invariant visible: flag writes require RBAC; client-supplied flag values never authorize access. Track flag_exposure_pct and citation_delta_v2_vs_v1 as the scoreboard. Surface under change control: POST /v1/rag/answer. If you only have forty minutes, finish the fixture for browser-exposed flag lets attackers force v2 (unreviewed) index before polishing UI. Promotion language stays ternary: promote, hold, or roll back based on evidence, not hope.
Read
Extra rehearsal for Feature flags lab (observability)
Set a timer for twelve minutes and attempt only the observability concerns for Feature flags lab. Speak aloud what release captain flipping rag_index_v2 for cohort canary would see on success versus on browser-exposed flag lets attackers force v2 (unreviewed) index. Write three bullet artifacts you must keep: a fixture name tied to FLAG-CLIENT-TRUST-4, a metric query for flag_exposure_pct and citation_delta_v2_vs_v1, and the rollback or refuse command for POST /v1/rag/answer. Then extend the notes with one sentence on how flag writes require RBAC; client-supplied flag values never authorize access would be violated if you skipped this page. Close by restating the oracle in your own words without looking: 5% cohort sees index_v2 citations; kill switch returns everyone to v1 in < 60s.
Go deeper
Before you start
Why this matters
Name the dashboard row or log line release captain flipping rag_index_v2 for cohort canary opens first during FLAG-CLIENT-TRUST-4. It must include a correlation id and a bounded label from flag_exposure_pct and citation_delta_v2_vs_v1. If telemetry is missing, write whether you promote, hold, or roll back — and why hold is the default.
In the wild
See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.
Related lessons
Check your understanding
Page assessment
Answer from memory. Completion is saved from this evidence, not from opening the next page.
All responses are required.