← Back to all products

SLI/SLO Framework

$39

A Python toolkit implementing Google's multi-window multi-burn-rate methodology: SLI computation, SLO evaluation with rolling windows, real-time error-budget tracking, auto-generated Prometheus/Grafana/Alertmanager rules, a Grafana dashboard, an SLO catalog, and executive reporting.

27 files
PythonYAMLMarkdownJSONGrafanaPrometheus

Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

Interactive Reader (Free Preview) ⚙ Try Demo Tools Download Free Sample

File Structure 27 files

sli-slo-framework/ ├── LICENSE ├── README.md ├── configs/ │ ├── grafana_dashboard.json │ └── slo_catalog.yaml ├── examples/ │ ├── __pycache__/ │ │ └── full_pipeline_demo.cpython-312.pyc │ └── full_pipeline_demo.py ├── free-sample.zip ├── guides/ │ └── error_budget_policy.md ├── index.html ├── interactive.html ├── src/ │ ├── __init__.py │ ├── __pycache__/ │ │ ├── __init__.cpython-312.pyc │ │ ├── alert_rules.cpython-312.pyc │ │ ├── burn_rate.cpython-312.pyc │ │ ├── error_budget.cpython-312.pyc │ │ ├── reporting.cpython-312.pyc │ │ ├── sli_metrics.cpython-312.pyc │ │ └── slo_calculator.cpython-312.pyc │ ├── alert_rules.py │ ├── burn_rate.py │ ├── error_budget.py │ ├── reporting.py │ ├── sli_metrics.py │ └── slo_calculator.py └── tests/ ├── __pycache__/ │ ├── test_sli_slo.cpython-312-pytest-9.0.2.pyc │ └── test_sli_slo.cpython-312.pyc └── test_sli_slo.py

Documentation Preview README excerpt

SLI/SLO Framework

A comprehensive Python toolkit for defining, measuring, and tracking Service Level Indicators (SLIs) and Service Level Objectives (SLOs). Implements Google's multi-window multi-burn-rate alerting methodology with error budget management.

Features

  • SLI Computation — Calculate availability, latency, throughput, and quality indicators from raw metric data
  • SLO Evaluation — Define targets with rolling compliance windows and automated status determination
  • Error Budget Tracking — Real-time budget consumption monitoring with velocity-based exhaustion prediction
  • Multi-Window Burn-Rate Alerting — Generate Prometheus and Grafana alert rules following Google SRE best practices
  • Executive Reporting — Markdown, JSON, and Slack-formatted compliance reports with trend analysis
  • Alert Rule Generation — Auto-generate Prometheus rules, Grafana provisioning JSON, and Alertmanager routing
  • Budget Policy Enforcement — Configurable thresholds that map budget levels to organizational actions

File Structure


sli-slo-framework/
├── README.md                          # This file
├── LICENSE                            # MIT License
├── src/
│   ├── __init__.py                    # Package initialization
│   ├── sli_metrics.py                 # SLI computation (availability, latency, quality, throughput)
│   ├── slo_calculator.py              # SLO definition, evaluation, and compliance checking
│   ├── error_budget.py                # Budget tracking, velocity, and policy enforcement
│   ├── burn_rate.py                   # Multi-window burn-rate alerting engine
│   ├── alert_rules.py                 # Prometheus/Grafana alert rule generation
│   └── reporting.py                   # Executive and team reporting
├── tests/
│   └── test_sli_slo.py               # Comprehensive unit tests
├── configs/
│   ├── slo_catalog.yaml              # Sample SLO definitions catalog (12 SLOs)
│   └── grafana_dashboard.json        # Pre-built Grafana SLO overview dashboard
├── guides/
│   └── error_budget_policy.md        # Deep-dive on error budgets & multi-burn-rate math
└── examples/
    └── full_pipeline_demo.py         # End-to-end demo: compute SLIs → evaluate SLOs → generate alerts

Requirements

  • Python 3.10+ (uses match statements, union type syntax, modern type hints)
  • Standard library only — no external dependencies

Quick Start

1. Define an SLI and SLO


from src.sli_metrics import SLIDefinition, SLIType
from src.slo_calculator import SLODefinition

# Define what to measure
sli = SLIDefinition(
    name="api-availability",
    sli_type=SLIType.AVAILABILITY,
    description="Fraction of requests that return non-5xx status",
    good_event_filter="status_code < 500",
    valid_event_filter="all API requests",
)

*... continues with setup instructions, usage examples, and more.*

Code Sample .py preview

src/alert_rules.py """ Alert Rules - Generates alerting configurations for various backends. This module translates SLO definitions into concrete alerting rules for: - Prometheus Alertmanager (YAML rule groups) - Grafana Alerting (JSON provisioning) - Generic webhook-based alerting (JSON payloads) The rules implement Google's multi-window multi-burn-rate methodology, which is the industry standard for SLO-based alerting. Each SLO gets multiple alert tiers that fire at different burn rates, ensuring: - Fast detection of severe incidents (high burn rate, short window) - Reliable detection of slow burns (low burn rate, long window) - Auto-resolution when issues are fixed (short window check) """ from dataclasses import dataclass from typing import Optional import json import logging from .burn_rate import ( BurnRateAlert, STANDARD_ALERT_TIERS_30D, derive_alert_tiers, ) from .slo_calculator import SLODefinition logger = logging.getLogger(__name__) @dataclass class AlertRoute: """Defines where an alert should be sent based on severity. Attributes: severity: Matches alert severity (page, ticket, warning). receivers: List of receiver names (Slack channels, PagerDuty, email). repeat_interval_minutes: How often to re-send if not acknowledged. group_wait_seconds: Wait time before sending first notification. """ severity: str receivers: list[str] repeat_interval_minutes: int = 60 group_wait_seconds: int = 30 @dataclass class AlertConfig: """Complete alerting configuration for an SLO. # ... 390 more lines ...