Command Palette

Search for a command to run...

Hectal
Phase 11: RAG in Production
RAG and Vector Search · Exercise 5 of 5 Previous
Advanced

Triage an incident snapshot

Write triage(m) taking a dict with the keys cross_tenant_hits, index_docs, docs_expected, oldest_wait and cost_micro, and returning the list of alert names that apply, in this priority order:

1. "leak" when cross_tenant_hits is above 0. 2. "shrunken index" when index_docs * 2 is less than docs_expected. 3. "stale answers" when oldest_wait is above 48. 4. "cost spike" when cost_micro is above 2 * 1700. A healthy snapshot returns an empty list.

What Check tests

  1. Healthy snapshot has no alerts
  2. Empty index is a shrunken index
  3. Exactly half the documents is not shrunken
  4. A leak comes first
  5. Thresholds are strict

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.