İçeriğe atla

Kontrol listeleri ·

Kullanım başına faturalanan bulut için korkuluklar

Kuyruk, zamanlanmış tetik ya da kendini çağıran işlev eklemeden önce bakılacak liste: döngü sınırı, yeniden deneme tavanı, harcama bekçisi, ilk müdahale.

İNDİR

Ne işe yarar

  • Bütçe uyarısının hiçbir şeyi durdurmadığını varsayar
  • Her döngüye kodda görünen bir üst sınır ister
  • Alarm gelince önce kaynağı durdurtur, sonra tanı koydurur

Kurulum

Dosyayı indir, deponun docs/ klasörüne koy ve ilk turu ekiple birlikte işaretle. Her 'hayır' için bir sahip ve tarih yaz.

Dosya önizlemesi

# Metered cloud guardrails

Usage-based platforms bill per request, per operation and per millisecond, and most of them have no hard ceiling. A budget alert is an email. It arrives after the fact and stops nothing. One loop that never ends can turn into a five-figure invoice overnight.

Use this list before the first deploy that adds a queue, a cron trigger, a durable object, a workflow, or any function that can call itself.

## In the code

- [ ] **Every loop has a fixed upper bound.** A counter or a depth limit, visible in the code. "It should terminate" is not a bound.
- [ ] **A function never calls its own URL.** Not directly, and not through a webhook that calls it back.
- [ ] **Scheduled wake-ups are conditional.** An alarm or timer that re-arms itself checks a stop condition first.
- [ ] **Queue consumers set `max_retries` and a dead-letter queue explicitly.** Do not rely on defaults.
- [ ] **Retries back off and give up.** Fixed maximum attempts, increasing delay.
- [ ] **Fan-out is capped.** One incoming event cannot enqueue an unbounded number of new events.
- [ ] **Cron frequency has a written reason.** If "every minute" could be "every ten", make it ten.
- [ ] **Writes are idempotent.** A repeated message does not repeat the side effect.

## Around the code

- [ ] **A spend watcher runs on a schedule you control.** It reads usage for the last hour, compares it to a threshold, and messages a person. Hourly beats the provider's daily alert.
- [ ] **The first response is written down:** stop the source (remove the route, disable the trigger), then diagnose.
- [ ] **Every account and token is on the watch list.** A new account is added the day it is created.
- [ ] **Provider alerts are set anyway,** at more than one level, sent to more than one person.
- [ ] **Free-tier accounts are noted as such,** and the note is updated the day one moves to a paid plan.

## At deploy time

- [ ] The diff that adds a metered binding for the first time is reviewed with one question: where is the loop gate?
- [ ] Usage is checked one hour after that deploy, by a person or a job, not assumed.
- [ ] The rollback id is recorded before the deploy.

## Signs you are already in trouble

- Request counts that climb in a straight line with no matching traffic.
- A queue whose depth never returns to zero.
- A function whose top caller is itself.
- Retry counts close to attempt counts.

If you see one of these, stop the source first.

---
From The Kai · thekai.co/library · Free to use and adapt.