Repository navigation
feat(sre): error budget tracker + burn-rate alerts (PR-012) - #5056
KooshaPari wants to merge 3 commits into
Conversation
…gates, build-scope guard, heap default (cheaper-inference#5054) Implements improvements 1-4 from the v3.8.36 release benchmark (_tasks/release-bench/v3.8.36/PLANO-MELHORIA.md): 1. Quality Ratchet decoupled from flaky coverage (ci.yml): the shard→coverage→ratchet chain meant a single flaky Coverage Shard SKIPPED the whole Quality Ratchet on the release PR (v3.8.36 cheaper-inference#4854), so cycle drift only surfaced post-merge in cheaper-inference#5029. The job now runs on !cancelled(); coverage download is continue-on-error and the ratchet runs --allow-missing, so the DETERMINISTIC gates (eslint/complexity/cognitive/duplication/ codeql) stay blocking even when coverage is unavailable. 2. Fast-path drift gates (quality.yml PR→release): added check:complexity, check:cognitive-complexity, and a new lightweight check:pack-policy (pack-artifact unexpected-files check WITHOUT a build, via --policy-only) so drift + stray-tarball-file regressions are caught/rebaselined PER-PR instead of cascading onto the release PR. 3. Build heap default 4096→8192 MB (build-next-isolated.mjs): the clean graph peaks ~3.9 GB and brushed the old 4 GB ceiling; 8 GB gives headroom. Comment notes heap is NOT the fix for a poisoned scope (run check:build-scope instead). 4. check:build-scope gate (new): fails if .ts/.tsx/.js/.jsx files in the tsconfig scope exceed a threshold — catches worktrees/cruft leaking into the build scope (the v3.8.36 OOM root cause: 355,215 vs 4,547 files) BEFORE it detonates next build. Wired into the fast-path.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Diagnosis: CI is RED with Fast Quality Gates and Unit Tests fast-path (2/2) failing. |
|
Thanks for this work, @KooshaPari 🙏 — closing after a maintainer review of all 46 open refactor PRs in this batch (yours included). This is not a rejection of the effort. Why closed (applies to the whole batch): every branch here is 44–50 commits behind This PR specifically: Needs rework — imports the orphaned observability stack, so it doesn't compile standalone; What happens to it: 📓 Captured as a documented lesson for our refactor roadmap — the approach is recorded (with your credit) and will guide the matching phase of our internal plan. The multi-window burn-rate algorithm (14.4×/6×/1×) and SLO catalog shape are recorded for the observability phase. We ran a full case-by-case triage. The approaches worth keeping are being recorded internally with author credit, so when we pick them up the attribution travels with the code. Thank you for pushing on this. 🙌 |
feat(sre): error budget tracker + burn-rate alerts (PR-012)
Production-grade error budget tracker for OmniRoute, built on top of the Prometheus + alert-rule surface shipped in PR-008 (#5018) and the W3C trace context from PR-006.
File list (11 files, +3,228 LOC)
src/lib/sre/errorBudget.tsErrorBudget({ slo, totalRequests, errorCount })calculator + sliding-window burn-rate engine (windowDays,windowMs,ErrorRateSamples,evaluateBurnAlerts,highestSeverity)src/lib/sre/sloDefinitions.tssrc/lib/observability/budgetMetrics.tsREGISTRY,recordBudgetMetric,renderPrometheusExposition, cardinality cap)src/app/api/v1/slo/route.tsGET /api/v1/slo- all SLOs + current statussrc/app/api/v1/slo/[sloId]/route.tsGET /api/v1/slo/{id}- single SLO + budget statesrc/app/api/v1/slo/[sloId]/burn/route.tsGET /api/v1/slo/{id}/burn?window=1h- burn-rate time seriestests/unit/sre/errorBudget.test.tstests/unit/sre/sloDefinitions.test.tstests/unit/sre/budgetMetrics.test.tstests/unit/sre/api/slo.test.tsdocs/sre/02-error-budgets.mdSLO catalog (5 SLOs)
Burn-rate alert thresholds (Google SRE workbook)
The fast-burn (1h, 14.4x) + slow-burn (6h, 6x) pair is the canonical Google SRE multi-window, multi-burn-rate alarm. Implemented in
errorBudget.evaluateBurnAlertsandbudgetMetrics.recordBudgetMetric.Prometheus metrics (gated by
SLO_TRACKER_ENABLED, defaultfalse)Cardinality cap: 5 SLOs x 5 windows x 3 severities = 75 series max.
enforceCardinalityCap()refuses to register metrics beyond that.Tests (node:test)
Constraints honoured
Date,Math.max,Map).SLO_TRACKER_ENABLEDenv (defaultfalse) inbudgetMetrics.isSloTrackerEnabled.@/lib/observabilitybarrel - does not duplicate the Prometheus registry.node:testper project pattern.Dependencies
/api/healthdeep checks for health-aware burn-rate suppression.Operator runbook
See
docs/sre/02-error-budgets.mdfor:Out of scope (deferred to follow-up PRs)
/api/v1/slo/{id}/burn?window=1hrolling time series). Will land with the budget-store migration in a follow-up.