Skip to main content

SRE Metrics Calculator & Reliability Analyzer โ€” SLO compliance, error budgets, incident analysis, alert auditing, toil estimation, and maturity scoring.

Project description

๐Ÿ“ก sre-beacon

SRE Metrics Calculator & Reliability Analyzer

A Python CLI tool for Site Reliability Engineering โ€” calculate SLO compliance, error budgets, availability nines, incident metrics (MTTR/MTTA/MTBF), toil estimation, Prometheus alert rule auditing, and SRE maturity assessment.

Features

Command What It Does
sre-beacon slo Calculate SLO compliance and error budgets
sre-beacon availability Calculate availability percentages and nines
sre-beacon incidents Analyze incidents โ€” MTTR, MTTA, MTBF
sre-beacon toil Estimate toil hours and automation potential
sre-beacon alerts Audit Prometheus/Alertmanager alert rules (15 rules)
sre-beacon maturity Assess SRE maturity across 8 dimensions
sre-beacon demo Run a full demo with sample data
sre-beacon rules List all 15 alert audit rules

Installation

git clone https://github.com/SanjaySundarMurthy/sre-beacon.git
cd sre-beacon
pip install -e .

Quick Start

# Run the full demo (creates sample data and runs all 6 analyses)
sre-beacon demo

# Run with verbose output
sre-beacon demo -v

Commands

SLO Compliance

sre-beacon slo slos.yaml actuals.yaml
sre-beacon slo slos.yaml actuals.yaml -v          # detailed error budgets
sre-beacon slo slos.yaml actuals.yaml -f json -o report.json

slos.yaml:

slos:
  - name: API Availability
    service: api-gateway
    sli_type: availability
    target: 99.9
    window_days: 30

actuals.yaml:

actuals:
  - name: API Availability
    value: 99.85
    burn_rate: 1.5

Availability Calculator

sre-beacon availability services.yaml
sre-beacon availability services.yaml -v    # nines comparison table

services.yaml:

services:
  - name: api-gateway
    total_minutes: 43200
    downtime_minutes: 45
    period: 30 days

Incident Analysis

sre-beacon incidents incidents.yaml
sre-beacon incidents incidents.yaml -v       # per-service breakdown
sre-beacon incidents incidents.yaml -f json -o report.json

Toil Estimation

sre-beacon toil tasks.yaml
sre-beacon toil tasks.yaml -v                # list all tasks
sre-beacon toil tasks.yaml --hours 200       # custom engineering hours

Alert Rule Audit

sre-beacon alerts alert-rules.yaml
sre-beacon alerts alert-rules.yaml -v              # show all issues
sre-beacon alerts alert-rules.yaml --fail-on critical   # CI/CD gate
sre-beacon alerts alert-rules.yaml -f json -o audit.json

SRE Maturity Assessment

sre-beacon maturity assessment.yaml
sre-beacon maturity assessment.yaml -v      # findings & recommendations

Alert Audit Rules (15)

Rule Severity Description
SRE-ALT-001 HIGH Alert without severity label
SRE-ALT-002 HIGH Alert without runbook_url annotation
SRE-ALT-003 MEDIUM Alert without description annotation
SRE-ALT-004 HIGH Alert without 'for' duration
SRE-ALT-005 MEDIUM Critical alert with excessive 'for' (>5m)
SRE-ALT-006 LOW Alert name doesn't follow CamelCase
SRE-ALT-007 INFO Complex expression (nested functions)
SRE-ALT-008 MEDIUM Alert without summary annotation
SRE-ALT-009 MEDIUM Duplicate alert name
SRE-ALT-010 LOW Alert without team/owner label
SRE-ALT-011 HIGH Warning alert configured to page
SRE-ALT-012 CRITICAL Alert expression is empty
SRE-ALT-013 MEDIUM Very short 'for' duration (<1m)
SRE-ALT-014 LOW Missing dashboard_url annotation
SRE-ALT-015 INFO Large alert group (>15 rules)

Maturity Dimensions (8)

  1. SLO Adoption โ€” SLO coverage, error budget tracking, review cadence
  2. Incident Management โ€” Process, post-mortems, action items, detection
  3. Monitoring & Observability โ€” Metrics, logging, tracing, golden signals
  4. Toil Reduction โ€” Tracking, automation projects, self-service tools
  5. Blameless Culture โ€” Post-mortems, learning reviews, psychological safety
  6. On-Call Practices โ€” Rotation, compensation, runbooks, handoff
  7. Capacity Planning โ€” Monitoring, projections, auto-scaling, load testing
  8. Change Management โ€” CI/CD, canary deployments, rollback, feature flags

Export Formats

  • Terminal โ€” Rich formatted output (default)
  • JSON โ€” Machine-readable export
  • HTML โ€” Styled dark-theme report

CI/CD Integration

# GitHub Actions โ€” fail on critical alert issues
- name: Audit Alert Rules
  run: |
    pip install sre-beacon
    sre-beacon alerts ./monitoring/alert-rules.yaml --fail-on critical

Testing

python -m pytest tests/ -v
# 101 tests, all passing

Architecture

sre_beacon/
โ”œโ”€โ”€ models.py                    # Core data models
โ”œโ”€โ”€ calculators/
โ”‚   โ”œโ”€โ”€ slo_calculator.py        # SLO compliance & error budgets
โ”‚   โ”œโ”€โ”€ availability_calculator.py  # Availability & nines
โ”‚   โ”œโ”€โ”€ incident_calculator.py   # MTTR, MTTA, MTBF
โ”‚   โ””โ”€โ”€ toil_calculator.py       # Toil estimation
โ”œโ”€โ”€ analyzers/
โ”‚   โ”œโ”€โ”€ alert_analyzer.py        # 15 alert audit rules
โ”‚   โ””โ”€โ”€ maturity_analyzer.py     # 8-dimension maturity scoring
โ”œโ”€โ”€ reporters/
โ”‚   โ”œโ”€โ”€ terminal_reporter.py     # Rich terminal output
โ”‚   โ””โ”€โ”€ export_reporter.py       # JSON & HTML export
โ”œโ”€โ”€ cli.py                       # Click CLI
โ””โ”€โ”€ demo.py                      # Demo data generator

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sre_beacon-1.0.0.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sre_beacon-1.0.0-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file sre_beacon-1.0.0.tar.gz.

File metadata

  • Download URL: sre_beacon-1.0.0.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for sre_beacon-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e26bd76fbd05435793f8250b9d95cfc08128f09ab05e3c0228f3895cf7d799fe
MD5 723d719b745b47161fdff0dda7e9c20b
BLAKE2b-256 fc23f944fc3bdd577356f17518c45bac9ff129f58498824aa851ec9205ebbeae

See more details on using hashes here.

File details

Details for the file sre_beacon-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sre_beacon-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for sre_beacon-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d31e7db516968be298c5656b56b47c9eedc30dc8cc214a4981308a223f967fb1
MD5 d0cdb0d3ca9d6d4630ca097c67bcfc1c
BLAKE2b-256 89ab614ae02b27a4f00142036cabc38abda5dcfedb75cf791a42438ab0d89806

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page