Update app/api/routes_governance.py
Browse files- app/api/routes_governance.py +14 -2
app/api/routes_governance.py
CHANGED
|
@@ -8,11 +8,23 @@ from app.services.intent_store import save_evaluated_intent
|
|
| 8 |
from app.services.outcome_service import record_outcome
|
| 9 |
from app.api.deps import get_db
|
| 10 |
from pydantic import BaseModel
|
|
|
|
| 11 |
import uuid
|
| 12 |
import logging
|
| 13 |
import time
|
| 14 |
|
| 15 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# ===== USAGE TRACKER IMPORTS =====
|
| 18 |
from app.core.usage_tracker import enforce_quota, UsageRecord, tracker
|
|
@@ -186,4 +198,4 @@ async def evaluate_healing_decision_endpoint(
|
|
| 186 |
processing_ms=(time.time() - start_time) * 1000,
|
| 187 |
)
|
| 188 |
await tracker.increment_usage_async(record, background_tasks)
|
| 189 |
-
raise HTTPException(status_code=500, detail=error_msg)
|
|
|
|
| 8 |
from app.services.outcome_service import record_outcome
|
| 9 |
from app.api.deps import get_db
|
| 10 |
from pydantic import BaseModel
|
| 11 |
+
from typing import Optional
|
| 12 |
import uuid
|
| 13 |
import logging
|
| 14 |
import time
|
| 15 |
|
| 16 |
+
# Optional import from protected core engine – not available in public Spaces
|
| 17 |
+
try:
|
| 18 |
+
from agentic_reliability_framework.core.models.event import ReliabilityEvent
|
| 19 |
+
except ImportError:
|
| 20 |
+
# Local fallback for public sandbox deployments
|
| 21 |
+
class ReliabilityEvent(BaseModel):
|
| 22 |
+
component: str
|
| 23 |
+
latency_p99: float
|
| 24 |
+
error_rate: float
|
| 25 |
+
service_mesh: str = "default"
|
| 26 |
+
cpu_util: Optional[float] = None
|
| 27 |
+
memory_util: Optional[float] = None
|
| 28 |
|
| 29 |
# ===== USAGE TRACKER IMPORTS =====
|
| 30 |
from app.core.usage_tracker import enforce_quota, UsageRecord, tracker
|
|
|
|
| 198 |
processing_ms=(time.time() - start_time) * 1000,
|
| 199 |
)
|
| 200 |
await tracker.increment_usage_async(record, background_tasks)
|
| 201 |
+
raise HTTPException(status_code=500, detail=error_msg)
|