Hmm, the user wants a golden metrics baseline with SLOs and burn-rate alerts. This is a structured reliability engineering request, likely from someone managing microservices. They probably need a practical template they can adapt quickly.
The response should cover: clear definitions of golden signals, concrete SLO examples (with reasoning), burn-rate alert thresholds (with both practical and strict tiers), and implementation steps. Need to emphasize that these are starting points, not rigid rules—context matters.
The user might not realize they also need guidance on how to roll this out across teams, so I’ll include a phased approach. Should avoid overcomplicating; stick to latency/errors/traffic/saturation as core metrics, with 99.9% availability as a common SLO. Burn-rate alerts must tie directly to error budgets.
Wait—they said “per service,” so I should stress that baselines must be service-specific. A payment service needs stricter latency SLOs than a logging service. Examples should reflect that nuance. Also, remind them to instrument consistently (OpenTelemetry) and review quarterly.
The tone should be authoritative but flexible, like a senior SRE giving a checklist. No fluff. If they’re asking this, they likely have some SLO knowledge already, so skip basic definitions but link concepts clearly.
Excellent. This is a core practice for modern SRE and platform engineering. Here is a comprehensive, actionable framework for creating a "Golden Metrics Baseline" with SLOs and burn-rate alerts per service.
1. The Foundation: The Four Golden Signals (per Service)
Every service must emit these four key metrics, ideally via OpenTelemetry.
| Signal | Definition | Typical Metric (Prometheus/OTel) | Why It's Golden |
|---|
| Latency | Time to serve a request. | http_request_duration_seconds_bucket (histogram) | Direct user experience. Use p95/p99 for critical paths. |
| Traffic | Demand on the service. | http_requests_total (counter) | Measures load, capacity planning, and anomaly detection. |
| Errors | Failed requests. | http_requests_total{status=~"5.."} (counter) | The most critical for SLOs. Must be filtered for server-side errors (5xx). |
| Saturation | How "full" the service is. | Custom: memory_usage_bytes, thread_pool_queue_size, disk_usage_percent | Measures resource constraints that precede failure. |
Service-Specific Nuance:
- API/Web Service: The four signals above are perfect.
- Background Worker/Job Processor: Replace
http_requests_total with jobs_processed_total. Latency = job_processing_duration_seconds.
- Datastore/Queue: Signals become
query_latency, connections_active, operation_errors, storage_used_percent or disk_iops_utilization.
2. Defining Service-Level Objectives (SLOs)
An SLO is a target level of reliability for a specific user journey over a time window.
Formula: (Total Good Events) / (Total Valid Events) >= Target (e.g., 99.9%)
A. Choose Your Core User Journey & Metric
- For an HTTP API:
Successful GET /api/v1/resource requests.
- Good Event: 2xx or 3xx response (define success per API spec).
- Valid Event: All requests to that endpoint (excluding authentication/validation errors that are client faults - 4xx).
- For a Data Pipeline:
Messages processed without error within 5min.
- For a Login Flow:
Logins completed with HTTP 200.
B. Set the Target (99.9% vs 99.99% vs 99.999%)
Use this rubric to start:
| Service Tier | Example | Suggested SLO Target | Error Budget per 30d | Rationale |
|---|
| Critical | Payment, Auth, Core API | 99.99% (4 nines) | ~43 seconds allowed | Direct revenue/critical function. Very low tolerance. |
| High | User Profile, Search, Notifications | 99.9% (3 nines) | ~43 minutes allowed | Important to user experience, but not catastrophic. |
| Medium | Internal Admin API, Batch Reports | 99.5% | ~3.6 hours allowed | Important, but some delay/failure is acceptable. |
| Low | Canary Deployment Service, Log Shipper | 99.0% | ~7.2 hours allowed | Non-user-facing, infrastructure support. |
Key Principle: The SLO must reflect user expectations. Don't use a 99.99% SLO for a nightly batch job that runs at 2 AM.
C. Select the Time Window
- 28 days (Calendar Month): Best for aligning with business cycles and engineering sprints. Recommended.
- 7 days: More volatile, good for fast-moving services.
- 30 days: Simple, but beware of varying month lengths.
3. The Fire Alarm: Burn-Rate Alerts
Burn-rate alerts tell you how fast you're consuming your error budget, not just that you've exceeded it. They warn you of a degrading service before the SLO violates.
Formula: Current Error Rate / Acceptable Error Rate (SLO target) = Burn Rate
- Acceptable Error Rate for a 99.9% SLO = 0.1% (0.001).
- If your current error rate is 1%, your burn rate = 0.01 / 0.001 = 10.
Alerting Thresholds (Multi-Window, Multi-Burn-Rate)
Use a combination of short (fast to detect) and long (reduce false positives) windows.
| Alert Level | Burn Rate | Short Window (e.g., 1h) | Long Window (e.g., 24h or 28d) | Action |
|---|
| ⚠️ Warning | > 2x | http_request_errors{...} / http_requests_total > ( (1 - slo) * 2 ) | No long-window check | "Something is wrong. Page the on-call engineer for the service team." |
| 🚨 Critical | > 14x (or > 10x for stricter) | AND http_request_errors{...} / http_requests_total > ( (1 - slo) * 14 ) | error_budget_remaining{...} < 0.02 (i.e., < 2% left) | "We are about to violate our SLO. Immediate engineering intervention required." |
Why 14x? A 14x burn rate for 1 hour consumes ~0.58% of a 30-day error budget. If sustained, it will exhaust the budget in ~50 hours, giving you time to react before the SLO violates over 28 days.
Example for a service with 99.9% SLO (0.1% acceptable error rate):
- Warning: Error rate > 0.2% in the last 1 hour.
- Critical: Error rate > 1.4% AND less than 2% of the 28-day error budget remains.
4. Implementation Blueight per Service
Step 1: Instrumentation & Validation
# Example Prometheus recording rules (slo_requests.yaml)
groups:
- name: service_slo
rules:
# Select *only* the "good" requests for your core journey.
- record: service:requests:success
expr: sum(rate(http_requests_total{status=~"2..|3..", route!~"/health|/metrics"}[5m]))
# All *valid* requests (the denominator).
- record: service:requests:total
expr: sum(rate(http_requests_total{route!~"/health|/metrics"}[5m])) - sum(rate(http_requests_total{status=~"4.."}[5m]))
Step 2: Define the SLO & Burn-Rate Alerts (Prometheus Alertmanager)
# Example Alertmanager rule (alerts_service.yaml)
groups:
- name: service-slo
rules:
# 1. SLO Burn Rate Warning
- alert: HighErrorRate
expr: |
(
(sum(rate(http_requests_total{status=~"5..", service="my-service"}[5m]))
/
sum(rate(http_requests_total{service="my-service"}[5m]))
) > ( (1 - 0.999) * 2 ) # 2x burn rate for 99.9% SLO
)
and
(
(error_budget_remaining{service="my-service", slo="0.999"} > 0)
)
for: 5m
labels:
severity: warning
service: my-service
annotations:
summary: "High error burn rate detected for {{ $labels.service }}"
description: "Error rate is {{ $value }}. Burn rate is > 2x. Error budget remaining: {{ $labels.error_budget_remaining }}%."
# 2. SLO Burn Rate Critical (Fast & Slow Window)
- alert: CriticalErrorBudgetBurn
expr: |
(
(sum(rate(http_requests_total{status=~"5..", service="my-service"}[5m]))
/
sum(rate(http_requests_total{service="my-service"}[5m]))
) > ( (1 - 0.999) * 14 ) # 14x burn rate
)
and
(
error_budget_remaining{service="my-service", slo="0.999"} < 0.02
)
for: 2m
labels:
severity: critical
service: my-service
annotations:
summary: "CRITICAL: Error budget burn for {{ $labels.service }}"
description: "Error rate is catastrophic. <2% error budget remains. Immediate rollback/investigation needed."
Step 3: Create the Dashboard (Grafana)
A single-pane-of-glass per service showing:
- Top Panel: Current SLO Compliance % (28d) and Remaining Error Budget %.
- Golden Signals Panel: Latency (p50/p95/p99), Traffic (RPS), Error Rate (4xx/5xx), Saturation (Key resource).
- Burn Rate Panel: Current burn rate vs. warning/critical thresholds.
- Error Budget Panel: A time-series of
error_budget_remaining.
5. Rollout & Governance Process
- Service Team Workshop: Define their core user journey and initial SLO target (use the tier rubric).
- Platform Team Review: Validate metrics, instrument consistently, and set baseline alert thresholds.
- Sign-off & Documentation: SLOs, alert thresholds, and dashboards are owned by the service team but approved by the platform/SRE team. Document in a central registry (e.g., a
slo.yml file in the service repo or a Backstage catalog).
- Review Cadence:
- Weekly: Check burn-rate alerts and error budget consumption.
- Monthly/Quarterly: Review SLOs. Are they too easy/too strict? Did we meet them? What incidents burned the budget? Adjust SLOs based on reality and business needs.
Key Principles to Remember
- SLOs Are a Contract: With your users and between product/dev/ops.
- Error Budget is for Risk-Taking: You spend your error budget to deploy, experiment, and improve. If you never burn it, your SLO is too easy.
- Alert on Burn-Rate, Not Just Violation: The goal is to prevent the SLO from violating, not just to be notified after the fact.
- Start Simple, Then Refine: Begin with a single, critical endpoint's availability SLO (99.9%) and its burn-rate alerts. Add latency SLOs (e.g., p95 < 300ms) later.
- Instrument Once, Use Everywhere: The same metrics feed SLOs, dashboards, and incident response.
This framework gives you a production-grade, actionable baseline. The exact numbers (99.9% vs 99.95%, 2x vs 5x) must be calibrated to your specific service's user expectations and tolerance for failure. The discipline is in the process, not the perfect initial number.