Error Budgets

Error budgets apply SRE principles to frontend reliability. Define a service level objective (SLO) for crash-free sessions, track budget consumption over time, and get alerted before the budget runs out.

Defining an SLO

An SLO specifies the minimum acceptable crash-free session rate over a rolling time window. Errors outside the defined scope are excluded from budget calculation.

error-budget.json
{
  "name": "Checkout stability",
  "sloTarget": 99.9,
  "metric": "crash_free_sessions",
  "window": "30d",
  "scope": {
    "pages": ["/checkout/*", "/payment/*"],
    "errorTypes": ["unhandled"]
  }
}

Burn rate calculation

Burn rate measures how fast you are consuming your error budget relative to the window duration:

  • 1x burn rate -- budget will be exactly exhausted at window end if current rate continues.
  • 2x burn rate -- budget will be exhausted halfway through the window.
  • 10x burn rate -- budget will be exhausted in 1/10th of the window. Warrants immediate investigation.
  • 50x burn rate -- critical incident. Budget is being consumed in minutes.
Burn Rate = (Errors in window / Total sessions in window) / Allowed error rate

Example:
  SLO target: 99.9% crash-free sessions
  Allowed error rate: 0.1%
  Current error rate: 0.5%
  Burn rate: 0.5% / 0.1% = 5x

Budget exhaustion alerts

Configure alerts that fire at specific budget consumption thresholds or when the burn rate exceeds a limit:

{
  "alerts": [
    {
      "trigger": "budget_consumed",
      "threshold": 50,
      "channels": ["email"],
      "message": "50% of error budget consumed with {daysRemaining}d remaining"
    },
    {
      "trigger": "budget_consumed",
      "threshold": 80,
      "channels": ["slack", "email"]
    },
    {
      "trigger": "burn_rate",
      "threshold": 10,
      "window": "1h",
      "channels": ["slack", "webhook"]
    }
  ]
}

Time window configuration

Error budgets support different time window strategies:

  • Rolling 7-day -- short-term stability view. Good for detecting recent regressions.
  • Rolling 30-day -- standard SLO window. Balances signal quality with stability.
  • Calendar month -- aligns with reporting periods. Budget resets on the first of each month.

CLI commands

# View current budget status
gurulu budgets status --site-id YOUR_SITE_ID

# Create a new error budget
gurulu budgets create --config error-budget.json

# View burn rate history
gurulu budgets burn-rate --site-id YOUR_SITE_ID --window 7d

For more on error-related alerts, see Alerting and Stability.