Chapter DProduction monitoring labPage 1 of 8

Production monitoring lab

Define the lab goal and success criteria

Production monitoring lab is production work only when one frozen failure can be reproduced, one measurable gate can stop a release, and one operator can safely reverse it.

~14 minLab goal

1Try it yourself

Playground

Production alert desk

Monitor quality, latency, and cost — alert vs rollback vs watch.

p95 latency 3× baseline

Before you start

Why this matters

Read this incident aloud: retrieval returns fewer chunks after an index refresh while HTTP status and model latency remain normal. In two minutes, write the earliest deterministic check that should fail, the telemetry signal you would inspect, and the action that must not happen automatically. Compare your answer with this chapter's boundary: operators see aggregates and redacted traces; raw user text requires break-glass access.

2Learn the idea

Read

Explain the system and define success

Start by drawing the boundary around production monitoring for a support RAG service after a canary deploy. The unit under control is not “the model”; it is one repeatable transaction from TelemetryEvent with release, request_id, intent, retrieved_count, groundedness, latency_ms, status, and cost_usd to IncidentDecision with severity, violated_slos, suspected_span, action, and rollback_release. In this lab, retrieval returns fewer chunks after an index refresh while HTTP status and model latency remain normal. That makes the learning target observable: we can replay the transaction, record the same fields, and decide whether a release is safer than its baseline. The primary decision metric is grounded answer rate by intent and release. The release rule is at least 0.93 grounded, error rate below 1%, and p95 below 2500 ms. Those values are deliberately paired: a single average cannot hide a critical subgroup or a security escape.

Write the failure before writing implementation code. Our named reproduction is: the global dashboard masks a 35% quality drop limited to account-recovery requests. A useful reproduction contains a frozen input, an expected decision, the release identifier, and enough deterministic dependencies to rerun locally. It must not depend on a live customer, changing clock, or unrestricted provider account. The fixture below is synthetic but shaped like production. Keep it in version control and add a case whenever an incident exposes a missing behavior.

Success has three levels. A request-level assertion explains one example. An aggregate metric catches drift over many examples. An operational rule says who acts and how quickly. Here, support_answer_grounded_ratio records the aggregate, while the request artifact carries a correlation ID. The owner should be able to move from an alert to the exact failing fixture without searching raw prompts. The security boundary is equally explicit: operators see aggregates and redacted traces; raw user text requires break-glass access.

The deliverable is a one-page acceptance contract plus the first red test. Do not tune a model yet; uncertainty about the contract is the bug to remove on this page.

Read

Focused implementation artifact

{"release":"2026.07.18-canary","request_id":"req_a19","intent":"account_recovery","retrieved_count":0,"groundedness":0.22,"latency_ms":1180,"status":200,"cost_usd":0.011}

Read

Turn the incident into a lab contract

Use the fixture above as the first row of an acceptance table. Add columns for expected decision, prohibited side effect, severity, policy version, and evidence to retain. The failure statement—the global dashboard masks a 35% quality drop limited to account-recovery requests—must be falsifiable: a teammate should know exactly which assertion turns red. Write the baseline result before trying a candidate so improvement is comparative rather than anecdotal.

Now calculate grounded answer rate by intent and release by hand for a three-case toy set: one pass, one ordinary failure, and one critical failure. Apply the published gate, at least 0.93 grounded, error rate below 1%, and p95 below 2500 ms, without rounding. This exposes whether weighting, critical-case overrides, and empty slices behave as intended. Emit support_answer_grounded_ratio once for the toy run and verify that its labels contain a bounded release and outcome, never fixture text.

The lab is ready only when its fixture is synthetic, its dangerous actions are replaced by recording fakes, and its evidence can be retained safely. The expected incident response is to freeze promotion, page the owner, inspect retrieval traces, then roll back the index alias if confirmed. Assign that decision to a role, not “the team,” and state which artifact proves recovery.

Checking tutor…

Continue learning · glossary & guides