{"name":"runbook-template","title":"Runbook template","description":"A runbook template in Markdown for an on-call alert, with what it means, the first five minutes, diagnosis steps, fixes, verification and escalation.","category":"writing","updated":"2026-11-30","url":"https://sniptide.com/templates/runbook-template","files":[{"name":"docs/runbooks/api-high-error-rate.md","language":"markdown","content":"# Runbook: API high error rate\n\n- Alert: `api_5xx_rate > 2% for 5m`\n- Service: Public API (`api` in production)\n- Owner: Platform team\n- Last tested: 2026-11-30\n\n## What the alert means\n\nMore than 2% of API requests have returned a `5xx` status for five minutes. Customers see failed\nrequests in the app and in their API integrations.\n\n## First five minutes\n\n1. Acknowledge the page so the next person isn't paged.\n2. Open the [API dashboard](https://grafana.example.com/d/api) and check whether errors are rising\n   or steady, and on which endpoints.\n3. Check [recent deploys](https://github.com/acme/api/deployments). If a deploy finished in the\n   last 30 minutes, go to [Roll back a deploy](#roll-back-a-deploy).\n4. If customers are affected for more than 10 minutes, declare an incident in `#incidents` and\n   post an update on the status page.\n\n## Diagnose\n\nCheck each in order and stop at the first that explains the errors.\n\n| Check | Command or link | If it shows a problem |\n| --- | --- | --- |\n| A recent deploy | `kubectl -n api rollout history deployment/api` | [Roll back a deploy](#roll-back-a-deploy) |\n| Database health | [Database dashboard](https://grafana.example.com/d/db) | [Database connections exhausted](#database-connections-exhausted) |\n| Pod restarts | `kubectl -n api get pods` | Read the logs of a restarting pod with `kubectl -n api logs <pod> --previous` |\n| A third-party outage | Status pages of the payment and email providers | Post on the status page and wait. Errors from these calls are retried. |\n\n## Fixes\n\n### Roll back a deploy\n\n```bash\nkubectl -n api rollout undo deployment/api\nkubectl -n api rollout status deployment/api\n```\n\nThe error rate should fall within five minutes. A rollback doesn't undo database migrations. If the\ndeploy included a migration, check the error message before rolling back.\n\n### Database connections exhausted\n\nLogs show `remaining connection slots are reserved`. Restart the API pods one at a time to release\nleaked connections:\n\n```bash\nkubectl -n api rollout restart deployment/api\n```\n\nThen open an issue to find the leak. Don't raise `max_connections` during the incident.\n\n## Verify\n\nThe incident is over when the error rate stays under 0.5% for 15 minutes on the API dashboard.\nPost a final status page update.\n\n## Escalate\n\nIf none of the fixes work within 30 minutes, page the Platform team's secondary on-call. For\ndatabase problems, also page the database owner.\n"}]}