The user wants me to "Design an SLO governance service" that includes "templates, burn-rate alerts, and roll-up views."
This is a system design problem focused on Site Reliability Engineering (SRE) practices, specifically Service Level Objectives (SLOs).
1. Deconstruct the Request:
Core Concept: SLO Governance Service. This isn't just an observability tool; it's a governance layer. It implies standardization, policy enforcement, and high-level visibility across an organization, not just for a single team.
Key Components:
Templates: Standardization of SLO definitions to ensure consistency (e.g., "Golden Signals" for web services).
Burn-rate Alerts: The mechanism for alerting based on the rate at which the "error budget" is consumed.
Roll-up Views: Aggregation of SLO status for executives and higher-level management (Service -> Subsystem -> Team -> Org).
Control Plane: Manages the definitions (CRDs or Config as Code).
Data Plane: Performs the calculations.
Integration: Needs to sit on top of existing metric systems (Prometheus/Thanos/Cortex) or ingest data. Let's assume an aggregator model is best for governance.
Drafting the Tech Stack:
Backend: Go or Python (standard for infra tools).
Database: Postgres for metadata, Time Series DB (Prometheus/Thanos) for the actual SLI data.
UI: React.
6. Refining the Specific Features requested:
Templates: Needs a "Service Catalog" integration. When a new service is onboarded, pick a template.
Burn Rate: Explain the math briefly but focus on the UI/Config experience. "Set target 99.9% -> Auto-generate 5 alert rules."
Roll-ups: Needs a tree data structure. Parent SLOs composed of Child SLOs.
7. Structuring the Response:
I will structure this as a technical design document (RFC/TDD).
Component 1: The Template Engine (Standardization): Defining schemas.
Component 2: The Burn Rate Engine (Alerting): Automated logic.
Component 3: The Roll-up Hierarchy (Visibility): Tree view.
Data Model: How do we store this?
User Experience (UX): How does a user interact with it?
Implementation Phases: MVP vs. Long term.
8. Self-Correction/Review during drafting:
Initial thought: Should I build a custom metrics database?
Correction: No, integration with existing observability vendors (Datadog, New Relic, Prometheus) is critical for adoption. The service acts as a configuration and aggregation layer.
Nuance on Governance: It's not just about templates; it's about compliance. "All Tier-1 services MUST have an availability SLO." I should add a "Compliance Report" section.
9. Final Polish:
Make sure to define "Burn Rate" clearly (rate of consumption relative to the budget period). Ensure the distinction between SLI (metric), SLO (target), and SLA (contract) is respected, though this service focuses on SLOs.
(Self-Correction on Roll-ups): How do you roll up dissimilar SLOs? (e.g., Latency and Availability).
Solution: Convert everything to "Error Budget Remaining %". This provides a common unit for aggregation.
Let's write the response. I will organize it logically, using bold headers and bullet points for readability. I will include a "Data Model" section to make it concrete. I'll use the "Service Hierarchy" concept to explain roll-ups.
Drafting content specifics:
Templates: Use JSON Schema or OpenAPI style definitions.
Burn Rate: Use the standard "Multi-window, Multi-burn-rate" approach.
Roll-up: Use a weighted average or "weakest link" approach for the aggregate score.
Let's generate the output.
Designing an SLO (Service Level Objective) Governance Service requires shifting from "monitoring metrics" to "managing reliability." This service acts as a control plane that sits on top of your observability stack (Prometheus, Datadog, Cloud Monitoring) to standardize how reliability is defined, measured, and alerted upon.
Here is a comprehensive design for the SLO Governance Service.
1. High-Level Architecture
The service functions as a configuration and state management layer.
Control Plane: Manages templates, definitions, and alerting logic.
Data Plane: Queries the underlying metrics stores to calculate actual performance.
User Interface: Provides the roll-up views and compliance reports.
mermaid
graph TD
UI[Developer Portal / UI] --> API[Gov Service API]
API --> DB[(Metadata Store)]
API --> TMPL[Template Engine]
API --> ALERT[Alert Generator]
subgraph "Observability Layer"
PROM[Prometheus/Thanos]
DD[Datadog/Cloud Ops]
end
ALERT --> PROM
ALERT --> DD
PROM -->|SLO Data| API
DD -->|SLO Data| API
2. Component: The Template Engine (Standardization)
The biggest failure in SLO adoption is fragmentation. One team measures latency at p95, another at p99. The Template Engine enforces standards while allowing flexibility.
Concept: Abstract SLO Definitions
Instead of writing raw PromQL, users select a "Service Type" (e.g., HTTP Service, GRPC Backend, Batch Job).
Template Structure (YAML Example):
yaml
kind: ServiceLevelObjective
metadata:
name: checkout-api-latency
serviceType: http-service # Maps to a template
spec:
# User provides simple inputs
target: 99.5
window: 30d
selector: { app: "checkout", env: "prod" }
# The Governance Service maps this to the underlying metric
indicators:
latency:
threshold: 400ms # The template defines this as 'Good' vs 'Bad'
availability:
excludeCodes: [503] # Governance rule: 503 might be maintenance
Governance Logic:
Schema Validation: Ensure every critical service has defined an Availability and Latency SLO.
Default Ratios: If a team sets a latency target but forgets availability, the service auto-applies a default availability target (e.g., 99.9%) based on the service tier.
3. Component: Burn Rate Alerting (The Engine)
This service should not just record SLOs; it should actively protect them. We use the Multi-Window, Multi-Burn-Rate algorithm (popularized by Google).
The Logic:
Instead of alerting when the SLO is broken (too late), we alert when the Error Budget is burning too fast.
How the Service Manages This:
The governance service generates 6 distinct alerting rules for every single SLO defined in the system.
Burn Rate
Long Window
Short Window
Severity
2% (Slow burn)
3 days
6 hours
Ticket (Low Priority)
5%
1 day
2 hours
Ticket
10% (Medium)
12 hours
1 hour
Page (High Priority)
20%
6 hours
30 mins
Page
50% (Catastrophic)
3 hours
15 mins
Page (Critical)
Automated Rule Generation:
The service takes the user's target (e.g., 99.9%) and injects it into the alerting templates.
Example: For a 99.9% SLO, a 2% burn rate means the error rate is currently 0.2% (double the monthly budget).
Output: The service pushes these rules to Prometheus AlertManager or Datadog Monitors automatically.
4. Component: Roll-Up Views (The Visibility)
The governance service provides a hierarchy of reliability, aggregating individual SLOs into higher-level views.
A. The Service Health Card (Atomic View)
This is the view for a service owner.
Current Status: Green / Yellow (Budget burning) / Red (Budget exhausted).
Remaining Budget: A progress bar (0% to 100%).
Trend: "At current burn rate, budget exhausted in 12 days."
B. The Team/Product Roll-Up (Aggregation)
This is the view for a Director or Product Manager. It aggregates multiple microservices into a single "Product" score.
Aggregation Method: We use Budget Weighted Availability.
Math: A critical service (99.99%) should impact the score more than an internal tool (99%).
Logic: The roll-up score is the average of all underlying services, weighted by their remaining error budget.
Columns: Compliance (Did they define an SLO? Is it monitored?).
Color Coding:
Blue: No SLO defined (Governance violation).
Green: SLO Met.
Red: SLO Violated (SLA breach risk).
5. The Data Model
To support this service, you need a robust relational/document structure.
Service Catalog Table:
ServiceID: checkout-api
Tier: Tier-1 (Critical) vs Tier-3 (Internal)
SLO_Policy_ID: Links to the template
SLO State Table (Updated daily or hourly):
ServiceID: checkout-api
SLO_Type: Latency
Target: 99.5
Actual: 99.65
Budget_Remaining: 45% (Calculated field)
Burn_Rate: 1.5% (Calculated field)
Status: HEALTHY
Audit Log:
Tracks when an SLO target was lowered (e.g., "Team Checkout reduced target from 99.9% to 99.5% to stop alerts"). This is crucial for governance.
6. Workflow & UX Features
The "Reliability Scorecard"
When a developer deploys a new service, the Governance Service blocks the "Production Ready" badge until:
An SLO is defined using the Template.
A Burn Rate alert is configured.
A runbook is linked to the alert.
Budget Reset & Reporting
Since error budgets reset monthly or quarterly, the service handles the windowing logic.
Reporting: Generates a PDF report at the end of the month: "You achieved 99.87% availability against a 99.9% target. You had 3 reliability incidents."
7. Technology Stack Recommendation
Backend: Go or Python (for calculation logic).
Database: PostgreSQL (for metadata/state) + Redis (for caching current rollups).
Querying: If using Prometheus, utilize Recording Rules. The governance service should manage the generation of recording_rules.yml files so that complex SLO queries are pre-calculated.