Page 5 of 8~112 min topic

Canary deploy lab

Design retries, degradation, and recovery

When automation promotes while scrape_up{revision=v2}==0, the system must degrade on purpose without widening blast radius.

~14 min this pageFailure handling

1Try it yourself

Decision drill

Canary deploy desk

Split traffic, watch metrics, rollback or promote — never big-bang without a safety net.

Release safety72%

1/3You routed 10% of traffic to v2. Smoke looks fine so far.

2Learn the idea

Read

Classify and bound retries

Map failure classes for POST /answer: retryable vs fatal vs needs-human. Retries need budgets, jitter, and idempotency rules aligned to promote only if canary error_rate ≤ baseline+0.5pp and groundedness ≥ baseline−1pp for two 10m windows. The chapter’s signature failure — automation promotes while scrape_up{revision=v2}==0 — must take a deliberate branch, not a generic catch-all.

Read

Containment path

Implement the degrade/rollback/refuse behavior release commander watching revision-sliced error rate needs when CANARY-PROMOTE-BLIND-6 repeats. Prefer scoped controls (one flag, one weight, one tenant, one secret version) over fleet-wide restarts. Preserve evidence; do not delete logs to “clean the demo.”

Read

Implementation artifact

./scripts/set_weight.sh --revision v2 --percent 0

Read

preserve logs + image digest answer@sha256:9e1c

Read

Verify harm reduction

After containment, check canary_weight, error_rate_by_revision, grounded_rate_by_revision moves in the safe direction and watch for retry amplification. Write the stop condition that ends the incident response for this lab.

Read

Stage depth

Chaos note: inject only one fault class at a time and restore fixtures after. Watch for dual failures — dependency down and retry amplifier — which is how automation promotes while scrape_up{revision=v2}==0 becomes an outage. Customer communication templates (even if only for the drill) beat silence. If you queue deferred work, define poison-message handling. Budget documents should state the maximum extra spend allowed during retries. Close the loop by linking the containment action to a dashboard panel for canary_weight, error_rate_by_revision, grounded_rate_by_revision.

Read

Field notes for `canary-deploy-lab` / `failure-handling`

Draw a state diagram for degrade modes and put it in the repo as ASCII if needed. Cap concurrent retries across the process, not only per request. Ensure cancellation propagates to downstream HTTP clients. When failing closed, choose a user-visible message that does not leak internals. Practice the single command that flips the kill switch or weight to zero. After recovery, drain or inspect deferred work before declaring green. In this chapter the product is containerized answer API releasing image v2 at 5%→25%→100% weights, the human stakeholder is release commander watching revision-sliced error rate, and the incident id you design against is CANARY-PROMOTE-BLIND-6. Re-state the oracle in your notes — 5% canary healthy 20m → promote to 25%; guardrail breach → weight 0 in < 2m — and keep the invariant visible: promote only if canary error_rate ≤ baseline+0.5pp and groundedness ≥ baseline−1pp for two 10m windows. Track canary_weight, error_rate_by_revision, grounded_rate_by_revision as the scoreboard. Surface under change control: POST /answer. If you only have forty minutes, finish the fixture for automation promotes while scrape_up{revision=v2}==0 before polishing UI. Promotion language stays ternary: promote, hold, or roll back based on evidence, not hope.

Go deeper

Before you start

Why this matters

Assume automation promotes while scrape_up{revision=v2}==0 is happening right now. Write the first safe action, the signal that confirms containment, and the action you will not take (infinite retry, broad restart, deleting evidence). Tie the plan to invariant: promote only if canary error_rate ≤ baseline+0.5pp and groundedness ≥ baseline−1pp for two 10m windows.

In the wild

See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.

Check your understanding

Page assessment

Answer from memory. Completion is saved from this evidence, not from opening the next page.

1. Are retry budgets explicit?
2. Is containment scoped?
3. Do you preserve evidence for CANARY-PROMOTE-BLIND-6?

All responses are required.