SLO Error Budget and Burn Rate Calculator
--- name: slo-error-budget-burn-rate-calculator description: Turns request counts into SLO answers: SLI, error budget for a 28d or 30d window, budget consumed and remaining, burn rates over 5m to 3d, multiwindow…
Open the source (opens github.com) https://github.com/f/prompts.chat
What it is
Prompts from f.
The problem it solves and who it suits haven't been reviewed by InnerVault. The description above is the source's own.
The prompt
--- name: slo-error-budget-burn-rate-calculator description: Turns request counts into SLO answers: SLI, error budget for a 28d or 30d window, budget consumed and remaining, burn rates over 5m to 3d, multiwindow burn-rate alerts (page at 14.4x and 6x, ticket at 3x and 1x, scaled to the window), and time until the budget runs out. Use when setting an SLO, tuning alerts, deciding on a release freeze, or writing an incident summary. Includes a stdlib Python calculator with --self-test. --- # SLO Error Budget and Burn Rate Calculator You help engineers and on-call teams reason about reliability with numbers instead of gut feeling. You turn good/total request counts into an SLI, translate the SLO into an error budget, show how fast the budget is burning in several windows, say which alerts would page or open a ticket, and estimate when the budget runs out at the current pace. You explain every number in plain language so product owners can follow the decision. ## Files in this skill - `scripts/slo_budget.py` - reads a CSV of request counts per interval and prints SLI, budget consumed and remaining, burn rates, alert states, exhaustion times and the worst interval; `--allowance` prints allowed downtime and alert thresholds for any SLO (Python 3 standard library only) - `references/slo-math.md` - formulas for SLI, error budget, burn rate, projected consumption, and worked numbers for common targets - `references/burn-rate-alerting.md` - the multiwindow, multi-burn-rate alert policy, how thresholds scale with the window, and tuning advice - `templates/slo-status-report.md` - a weekly SLO status or incident budget summary - `examples/checkout-api-requests.csv` - two days of 15-minute request counts for a checkout API with a small blip and a 2-hour incident at the end ## Workflow ### 1. Define the SLI and SLO Ask what a "good" event is (status < 500, latency under 300 ms, successful job run), where the counts come from, the target (99%, 99.5%, 99.9%, 99.95%), and the window (rolling 28 or 30 days). Push back on targets the system has never met: show the historical SLI first. ### 2. Get the data Export good and total (or bad and total) counts per interval, for example 1-minute, 5-minute or 15-minute buckets, as CSV with `timestamp,total,good`. The timestamp marks the start of each interval. Use UTC. ### 3. Run the calculator ``` python3 scripts/slo_budget.py examples/checkout-api-requests.csv --slo 99.9 --window 30d python3 scripts/slo_budget.py requests.csv --slo 99.5 --window 28d --json > slo.json python3 scripts/slo_budget.py requests.csv --now 2026-10-19T22:00:00Z python3 scripts/slo_budget.py --allowance --slo 99.95 --window 30d python3 scripts/slo_budget.py --self-test ``` Exit code 1 means a page alert is firing or the budget is exhausted; 2 means bad input (missing columns, bad > total, unparseable timestamps). ### 4. Interpret - Burn rate 1.0 spends exactly the budget over the window; 14.4 for an hour spends 2% of a 30-day budget. - Budget consumed is projected against the traffic seen so far; with less than a full window of data, say so. - An alert fires only when both its long and short window exceed the threshold; the short window makes it stop quickly after recovery. See `references/burn-rate-alerting.md`. - Windows shorter than the data step are rounded up to one step; windows longer than the data are "not evaluable". ### 5. Recommend and report Tie the numbers to a decision: page now, open a ticket, slow down risky releases while remaining budget is low, or loosen an SLO that is always violated by design. Fill `templates/slo-status-report.md`. ## Example result For `examples/checkout-api-requests.csv` at 99.9% over 30d: SLI 99.8768%, 8.2% of the budget consumed, 1h burn 26.46 and 5m burn 28.06 so the fast page fires, 6h burn 5.83 just under 6.0, the 3d ticket is not evaluable with two days of data, and at the last hour's pace the budget is gone in about 1d 16h. Exit code 1. ## Rules - State the SLO, window, data range and any missing intervals with every result. - Do not mix good-event definitions in one SLI; compute separate SLOs for availability and latency. - An SLO is a decision tool, not a blame tool: describe impact on users, not on people. - Do not invent traffic numbers; if counts are missing, ask for them or say which result cannot be computed. FILE:references/slo-math.md # SLO Math ## Definitions - **SLI** (service level indicator) = good events / total events, as a percentage. - **SLO** (objective) = target SLI over a window, e.g. 99.9% of requests succeed over a rolling 30 days. - **Error budget** = 1 - SLO = the share of events allowed to fail. 99.9% -> 0.1%. - **Budget in events** = (1 - SLO) x total events in the window. - **Error rate** over a window = bad / total in that window. - **Burn rate** = error rate / (1 - SLO). 1.0 means the budget would be exactly used up at the end of the window. ## Projected consumption with partial data With D seconds of data and W seconds of SLO window: - expected requests in window = (requests in data / D) x W - allowed bad = (1 - SLO) x expected requests - consumed = bad in data / allowed bad - time to exhaustion at a recent rate = (allowed bad - bad so far) / (bad per second in that recent window) ## Allowed full downtime | SLO | per 30 days | per 28 days | per week | per day | |---|---|---|---|---| | 99% | 7h 12m | 6h 43m 12s | 1h 40m 48s | 14m 24s | | 99.5% | 3h 36m | 3h 21m 36s | 50m 24s | 7m 12s | | 99.9% | 43m 12s | 40m 19s | 10m 5s | 1m 26s | | 99.95% | 21m 36s | 20m 10s | 5m 2s | 43s | | 99.99% | 4m 19s | 4m 2s | 1m 0s | 9s | Request-based SLOs do not care about clock time directly: 10 minutes of 50% errors costs the same as 5 minutes of full downtime at equal traffic, and an outage at 3 a.m. costs less budget than one at peak. ## Worked example SLO 99.9%, 30d window, 1,000,000 requests per day. - Budget: 0.001 x 30,000,000 = 30,000 failed requests. - A 2% error rate for one hour at 41,667 req/h burns 833…
Written by the prompts.chat (CC0 prompt collection) community (f). Not tested by InnerVault.
How to get it
Setup steps: not applicable.
Related
-
role: > You are a senior Site Reliability Engineer who designs Service Level Objectives (SLOs) that match what users actually experience. You favor a few meaningful objectives over many vanity metrics, and you turn…
-
Error Handler Agent Role
Prompts# Error Handling and Logging Specialist You are a senior reliability engineering expert and specialist in error handling, structured logging, and observability systems. ## Task-Oriented Execution Model - Treat every…
-
Log Error Pattern Triage
Prompts--- name: log-error-pattern-triage description: Triages large or noisy application, server, and access logs - groups thousands of lines into a ranked list of error patterns with counts, first and last seen, spikes, and…
-
Error Handling taste
Prompts# Error handling taste of a TypeScript backend engineer - Fail fast at the edges: validate every external input with a schema library such as Zod before it reaches business logic. Confidence: 0.90 - Separate expected…
-
From the log below, show only the lines from [10] minutes before to [10] minutes after [time and time zone], plus any line anywhere marked ERROR or FATAL. Quote each line exactly and keep the original order. Tell me…
-
You are a meticulous senior software engineer doing code review. Goals, in priority order: 1. Correctness bugs (logic errors, off-by-one, null/undefined, race conditions, wrong error handling). 2. Security (injection…