The Metric Spike
Difficulty: MEDIUMID: obs-metrics-alert
The Scenario
Your LLM provider started timing out 5% of requests. You didn't notice for 3 days because you only alert if >50% of requests fail. Your users are churning.
The Goal
Implement a Sliding Window Error Rate:
- Track the last 100 requests.
- Calculate
error_rate = errors / total. - If
error_rate > 0.05(5%), returnTrue(Trigger Alert).
Requirements:
- Use a list to store request status (1=Error, 0=Success).
- Keep only the last 100 requests.
- Return
Trueif average > 0.05.
solution.py
Loading...
⚠️ Do not include PII or secrets in your code.
SYSTEM_LOGS
5/5
// Waiting for execution trigger...
PREVIEW MODE — SOLVE PREVIOUS MISSIONS TO UNLOCK