feat(ift): EventHub AI Router stack for Zed
FastAPI gateway with A/B/C lane orchestration, LiteLLM proxy config, Swarm stack (postgres, redis, VPN off-by-default), deploy/smoke/audit scripts.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
"""Prometheus metrics for gateway tier/lane routing."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from prometheus_client import CONTENT_TYPE_LATEST, Counter, Histogram, generate_latest
|
||||
|
||||
REQUESTS = Counter(
|
||||
"ai_router_requests_total",
|
||||
"Total routed requests",
|
||||
["tier", "lane", "model", "status"],
|
||||
)
|
||||
ESCALATIONS = Counter(
|
||||
"ai_router_escalations_total",
|
||||
"Lane escalations",
|
||||
["from_lane", "to_lane", "reason"],
|
||||
)
|
||||
CLASSIFY = Counter(
|
||||
"ai_router_classify_total",
|
||||
"Classification results",
|
||||
["tier"],
|
||||
)
|
||||
DURATION = Histogram(
|
||||
"ai_router_request_duration_seconds",
|
||||
"Request duration",
|
||||
["tier", "model"],
|
||||
buckets=(0.1, 0.25, 0.5, 1, 2, 5, 10, 30, 60, 120, 180),
|
||||
)
|
||||
|
||||
|
||||
def metrics_payload() -> tuple[bytes, str]:
|
||||
return generate_latest(), CONTENT_TYPE_LATEST
|
||||
Reference in New Issue
Block a user