Recipe: week-one alerts
Counts and dollars are example numbers. In production they come from the traces and metrics of Topic 11.6.
The checklist to run before real users arrive, written as a gate that reports blockers, and the alerts to watch every day of the first week.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write day_alerts(questions, refused, limit) returning 'alert' when refused / questions is greater than limit and 'ok' otherwise. Print the result for two days.
Write cost_ratio(day, baseline_day) that returns the cost per question of day divided by the baseline's, where each is a (questions, dollars) pair. Print it with two decimals for (1400, 3.6) against (1000, 1.2).
Explain it without notes
What are the four areas of the launch gate and one check from each?
Why express yes/no facts as numbers in the gate?
Which signals do you watch in the first week, and what does each point to?
Why launch in steps instead of all at once?
Expected output
day 1: ok
day 2: ok
day 3: ok
day 4: refusal rate 0.20 (limit 0.15)
day 5: thumbs-down rate 0.12 (limit 0.10)
day 6: p95 6.8 s (limit 6.0)
day 7: cost per question x2.14 of day 1 (limit x2.00)
alerts on days: 4, 5, 6, 7