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:

  1. Track the last 100 requests.
  2. Calculate error_rate = errors / total.
  3. If error_rate > 0.05 (5%), return True (Trigger Alert).

Requirements:

  • Use a list to store request status (1=Error, 0=Success).
  • Keep only the last 100 requests.
  • Return True if 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