Skip to content

Add SLO evaluation with error budget and burn-rate alerts#280

Merged
JE-Chen merged 2 commits into
devfrom
feat/slo
Jun 21, 2026
Merged

Add SLO evaluation with error budget and burn-rate alerts#280
JE-Chen merged 2 commits into
devfrom
feat/slo

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 21, 2026

Copy link
Copy Markdown
Member

Summary

The framework emits raw signals (observability metrics, run_history durations) but had no operational layer turning them into an SLO, an error budget, or burn-rate alerts. This adds that.

  • evaluate_slo(records, target, *, window_s, now){sli, good, total, budget_total, budget_remaining, budget_remaining_fraction, burn_rate}.
  • burn_rate(...) — the bare burn rate over a window.
  • burn_alerts(records, target, *, rules, now) — multi-window multi-burn-rate alerts; default_burn_rules() are the Google SRE tiers (page 14.4×@1h/5m, page 6×@6h/30m, ticket 1×@3d/6h), firing only when both windows exceed the threshold. BurnRule to customise.

Records are plain data ([{"timestamp", "ok"}]), clock injectable → fully deterministic. Pure stdlib.

Five-layer wiring

  • Headless core: je_auto_control/utils/slo/
  • Facade: re-exported from __init__.py + __all__
  • Executor: AC_evaluate_slo, AC_burn_alerts
  • MCP: ac_evaluate_slo, ac_burn_alerts
  • Script Builder: "SLO: Evaluate" / "SLO: Burn-Rate Alerts" under Report

Tests & docs

  • test/unit_test/headless/test_slo_batch.py (11 tests: budget math, burn rate, windowing, multi-window alerts fire/quiet, bad target)
  • v72 feature docs (EN + Zh) + toctree
  • What's-new in all three READMEs

Lint clean: ruff / pylint / bandit / radon.

The framework emitted raw signals but had no operational layer turning
them into an SLO. Add evaluate_slo (SLI + error budget), burn_rate, and
multi-window multi-burn-rate alerts (Google SRE workbook tiers) over
outcome records. Records are plain data and the clock is injectable, so
it is fully deterministic. Wired through the facade, AC_evaluate_slo/
AC_burn_alerts executor commands, MCP tools and the Script Builder.
@codacy-production

codacy-production Bot commented Jun 21, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 42 complexity · 0 duplication

Metric Results
Complexity 42
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit e46f708 into dev Jun 21, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/slo branch June 21, 2026 12:39
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant