Error budget policies are a critical component of Site Reliability Engineering that directly link your service's reliability performance to development priorities. An error budget is the maximum allowable unreliability (e.g., downtime, latency, errors) over a defined period, derived directly from your Service Level Objectives (SLOs). When a service is performing well and meeting its SLOs, its error budget is healthy, signaling that there's room to innovate, launch new features, and take calculated risks. Conversely, when the service experiences incidents or degradation, it "spends" its error budget. These policies define the specific actions taken as this budget depletes, ensuring a proactive approach to maintaining reliability.
The core dilemma these policies address is: when do we prioritize stability over new features? When the error budget is abundant, teams are encouraged to push features, perform A/B tests, and iterate quickly. However, when the budget approaches exhaustion or is completely spent, the policy triggers a shift. "Freezing deploys" is a common action, meaning that non-critical, feature-related deployments are paused or blocked. This allows engineering teams to dedicate their full attention to reliability work, such as fixing root causes of recent incidents, addressing technical debt, refactoring problematic code, or improving monitoring and alerting. The goal is to stop further potential degradation and restore the service's health, replenishing the error budget.
It's rarely an instant, hard stop. Effective error budget policies often incorporate tiered thresholds and actions. For instance, a warning might be issued when 75% of the budget is spent, leading to increased scrutiny on new deployments. A "soft freeze" might occur at 90%, requiring manager approval for any non-critical change. A "hard freeze" at 100% might block all feature deploys and mandate a reliability-focused sprint until the budget recovers. This dynamic incentivizes development teams to build reliable systems from the outset, as their ability to ship new features is directly tied to the service's reliability. It ensures a healthy tension between innovation and operational stability, aligning SRE and development goals.
Key Takeaways
- Error budget policies link service reliability (SLO performance) directly to development activities.
- A healthy error budget allows teams to push new features; a depleted budget triggers reliability-focused work.
- "Freezing deploys" is a common policy when the budget is spent, halting non-critical changes to prevent further unreliability.
- Policies often use tiered thresholds (e.g., warnings, soft freeze, hard freeze) to escalate actions as the budget depletes.
- These policies incentivize proactive reliability engineering and align SRE and development teams on shared goals.
Code Example
errorBudgetPolicy:
service: "api-gateway-service"
timeWindow: "28d" # Rolling 28-day window
budgetThresholds:
- name: "warning-level"
percentageSpent: 75
action: "notify-oncall-and-leads"
message: "Budget approaching limit, review open incidents."
- name: "soft-freeze-level"
percentageSpent: 90
action: "halt-non-critical-deploys"
message: "Non-critical deploys blocked. Focus on reliability fixes."
- name: "hard-freeze-level"
percentageSpent: 100
action: "halt-all-feature-deploys-and-request-remediation-plan"
message: "Budget exhausted. All feature deploys frozen. Critical reliability sprint required."How this code works
This code defines an error budget policy for the specific service called "api-gateway-service". Its job is to set up automated rules for how a team should react as their error budget gets spent. The timeWindow specifies that this policy applies to budget consumption over a rolling 28-day period. The core of the policy is found in budgetThresholds, which lists different levels of budget spending and the actions to take at each point.
Each item within budgetThresholds represents a particular severity level. When the percentageSpent of the error budget reaches that amount, a specific action is triggered, accompanied by a descriptive message. For instance, at 75% spent, the policy triggers a warning-level notify-oncall-and-leads action. Reaching 90% activates a soft-freeze-level, which might halt-non-critical-deploys. Finally, exhausting the budget at 100% triggers a hard-freeze-level to halt-all-feature-deploys-and-request-remediation-plan. A subtle but critical detail is that these thresholds are generally evaluated from least to most severe, with the most severe breached threshold dictating the active policy. This ensures that if the budget hits 100%, the system correctly applies the hard freeze, rather than just adding to prior notifications.