mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 05:57:21 -05:00
feat: Add domain architecture and extract core services from Prism Console
## Domain Architecture - Complete domain-to-service mapping for 16 verified domains - Subdomain architecture for blackroad.systems and blackroad.io - GitHub organization mapping (BlackRoad-OS repos) - Railway service-to-domain configuration - DNS configuration templates for Cloudflare ## Extracted Services ### AIops Service (services/aiops/) - Canary analysis for deployment validation - Config drift detection - Event correlation engine - Auto-remediation with runbook mapping - SLO budget management ### Analytics Service (services/analytics/) - Rule-based anomaly detection with safe expression evaluation - Cohort analysis with multi-metric aggregation - Decision engine with credit budget constraints - Narrative report generation ### Codex Governance (services/codex/) - 82+ governance principles (entries) - Codex Pantheon with 48+ agent archetypes - Manifesto defining ethical framework ## Integration Points - AIops → infra.blackroad.systems (blackroad-os-infra) - Analytics → core.blackroad.systems (blackroad-os-core) - Codex → operator.blackroad.systems (blackroad-os-operator) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
42
services/aiops/slo_budget.py
Normal file
42
services/aiops/slo_budget.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""SLO budget utilities."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
from . import ARTIFACTS, _inc
|
||||
|
||||
|
||||
def budget_status(
|
||||
service: str,
|
||||
window: str,
|
||||
data: Dict = None,
|
||||
artifacts_dir: Path = ARTIFACTS,
|
||||
) -> dict:
|
||||
"""Compute error budget status for a service."""
|
||||
if data is None:
|
||||
path = artifacts_dir / "slo" / f"{service}.json"
|
||||
with open(path, "r", encoding="utf-8") as fh:
|
||||
data = json.load(fh)
|
||||
target = data.get("target", 1.0)
|
||||
errors = data.get("errors", 0.0)
|
||||
total_budget = max(1.0 - target, 1e-9)
|
||||
remaining = max(total_budget - errors, 0.0)
|
||||
remaining_pct = remaining / total_budget
|
||||
state = "ok"
|
||||
if remaining_pct == 0:
|
||||
state = "burning"
|
||||
elif remaining_pct < 0.5:
|
||||
state = "warn"
|
||||
|
||||
ts = datetime.utcnow().strftime("%Y%m%d%H%M%S")
|
||||
out_dir = artifacts_dir / "aiops"
|
||||
out_dir.mkdir(parents=True, exist_ok=True)
|
||||
out = {"service": service, "window": window, "remaining_pct": remaining_pct, "state": state}
|
||||
with open(out_dir / f"slo_budget_{ts}.json", "w", encoding="utf-8") as fh:
|
||||
json.dump(out, fh, indent=2)
|
||||
if state != "ok":
|
||||
_inc("aiops_budget_alerts")
|
||||
return out
|
||||
Reference in New Issue
Block a user