Sample runbook: Checkout API: elevated 5xx errors
Runbook: Checkout API: elevated 5xx errors
Service#
- Service: checkout-api
- Owner: Payments team
- On-call: #payments-oncall (PagerDuty: Payments Primary)
When to use this runbook#
- Alert: CheckoutApi5xxRateHigh fires (5xx > 2% of requests for 5 minutes)
- Customers report failed payments in #support-escalations
Customer impact#
Customers cannot complete purchases. Treat as SEV-2 if more than 5% of checkouts fail, SEV-1 above 25%.
Before you start#
- Grafana: Checkout API overview dashboard
- Logs: service:checkout-api status:5xx in the log explorer
- Deploy history: #deploys channel and the CD pipeline
- Stripe status page and the Stripe dashboard
Diagnose#
- Check whether a deploy shipped in the last 30 minutes.
- Split 5xx by route: is it all routes or only POST /payments?
- Check Stripe API error rate and latency on the dashboard.
- Check database connection pool saturation and slow queries.
- Look for a single noisy customer or a traffic spike.
Useful commands#
kubectl -n payments get pods -l app=checkout-api
kubectl -n payments logs deploy/checkout-api --since=15m | grep ERROR
kubectl -n payments rollout history deploy/checkout-api
Mitigate#
- If a deploy caused it, roll back to the previous release.
- If Stripe is degraded, enable the checkout-queue feature flag so payments retry asynchronously.
- If the connection pool is saturated, scale checkout-api to 2x replicas.
- If one customer is responsible, rate-limit their API key.
Roll back#
- kubectl -n payments rollout undo deploy/checkout-api
- Disable the checkout-queue flag once Stripe recovers.
Verify recovery#
- 5xx rate under 0.5% for 15 minutes.
- Successful checkouts per minute back within 10% of the same time last week.
- No new errors in #support-escalations.
Escalate#
- No improvement after 20 minutes: page the Payments secondary.
- SEV-1 or data integrity risk: page the incident commander.
- Stripe-side outage: open a Stripe support case and post in #status.
After the incident#
- Write the incident timeline within 24 hours.
- Schedule a blameless postmortem for SEV-1 and SEV-2.
- Update this runbook with anything that was missing or wrong.