Production monitoring lab
Define the lab goal and success criteria
Ship a falsifiable slice of **Prometheus+Grafana board for AI answer API golden signals** — success is inject 5% 500s for 10m → Alert AnswerErrorBurn fires; recovery clears within 15m, not a polished screenshot.
1Try it yourself
Decision drill
Production alert desk
Monitor quality, latency, and cost — alert vs rollback vs watch.
1/3p95 latency is 3× baseline after a model bump. Errors look normal.
2Learn the idea
Read
Name the operable slice
This lab builds Prometheus+Grafana board for AI answer API golden signals. The human in the loop is SRE watching error budget during a model bump. Scope is intentionally narrower than “make AI reliable”: you will prove one oracle — inject 5% 500s for 10m → Alert AnswerErrorBurn fires; recovery clears within 15m — and one invariant — alerts require multi-window evidence; missing scrape ≠ healthy silence. Record non-goals in your notes so a later change cannot silently expand authority. The incident mnemonic for the chapter is MON-TENANT-BLIND-9; design as if that ticket is already written and you are filling evidence.
Read
Write the acceptance contract
Turn the oracle into a table: input fixture, expected observable, prohibited side effect, owner, latency/cost ceiling. Separate model taste from software correctness — transport, auth, parsing, and termination must be deterministic even when generated text varies. Primary metric family: alert_precision on game-day ≥ 0.9 and scrape_up == 1. Averages without a denominator or revision label do not gate release. Fake external dependencies in unit tests; live calls wait until fakes pass.
Read
Implementation artifact
groups:
- name: answer-api
rules:
- alert: AnswerErrorBurn
expr: sum(rate(http_requests_total{status=~"5.."}[5m])) / sum(rate(http_requests_total[5m])) > 0.05
for: 10m
Read
Freeze the first red test
Before implementation, encode a failing check that would have caught dashboard averages hide tenant Acme 40% error rate. That failure is the pedagogical north star for later pages: contracts reject it, happy path never performs it, validation asserts it, failure-handling contains it, observability detects it, security-ops prevents privilege tricks around it, and mastery replays it in a drill. Endpoint under study: GET /metrics.
Read
Stage depth
Capacity note for planners: estimate peak demand on GET /metrics and the cost ceiling for a failed retry storm. Write the abort conditions — unbounded spend, cross-tenant leakage, or inability to roll back — before you enjoy the first green test. Prefer synthetic fixtures shaped like production over anonymized production dumps you cannot share in class. When you are tempted to widen scope, re-read the oracle (inject 5% 500s for 10m → Alert AnswerErrorBurn fires; recovery clears within 15m) and cut features that do not serve it. The teaching outcome is judgment under constraints: SRE watching error budget during a model bump gets a trustworthy control, not a kitchen-sink framework. Keep the language of release decisions: promote, hold, or roll back — never “see if it gets better.”
Read
Field notes for `production-monitoring-lab` / `lab-goal`
Decide what will live in version control on day one: fixtures, contract markdown, and a failing test name. Write the cost ceiling as a hard number with currency and period. If the lab involves clusters, name the non-prod context you will use and forbid prod kubecontexts in scripts. Capture the baseline metric once before changing code so later gains are comparative. Refuse tools that hide the request path behind magic macros until the oracle is green on fakes. Your README section for this page should be five lines or fewer and still falsifiable. In this chapter the product is Prometheus+Grafana board for AI answer API golden signals, the human stakeholder is SRE watching error budget during a model bump, and the incident id you design against is MON-TENANT-BLIND-9. Re-state the oracle in your notes — inject 5% 500s for 10m → Alert AnswerErrorBurn fires; recovery clears within 15m — and keep the invariant visible: alerts require multi-window evidence; missing scrape ≠ healthy silence. Track alert_precision on game-day ≥ 0.9 and scrape_up == 1 as the scoreboard. Surface under change control: GET /metrics. If you only have forty minutes, finish the fixture for dashboard averages hide tenant Acme 40% error rate before polishing UI. Promotion language stays ternary: promote, hold, or roll back based on evidence, not hope.
Go deeper
Before you start
Why this matters
Write the single done-definition a reviewer would accept for Production monitoring lab (MON-TENANT-BLIND-9). Include the numeric gate hidden in this oracle: inject 5% 500s for 10m → Alert AnswerErrorBurn fires; recovery clears within 15m. Then name the fake success you refuse: a demo that ignores dashboard averages hide tenant Acme 40% error rate. Keep the sentence beside your editor; every later page should make this sentence easier to prove.
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.