GET /metrics¶
Prometheus exposition. The gateway emits a small, stable set of counters and histograms. No authentication is required; the endpoint is public.
Request¶
No parameters, no body.
The response uses the Prometheus text exposition format and the
standard Content-Type: text/plain; version=0.0.4.
Metrics¶
| Name | Type | Labels | Notes |
|---|---|---|---|
sgw_requests_total |
Counter | model, status |
One increment per request reaching the gateway. status is 200, 403, 500, etc. model is the real OpenRouter ID. |
sgw_routing_decisions_total |
Counter | action, model |
Routing decision counter. action is ROUTE, SCOUT, STOP_FOR_HUMAN, FALLBACK_TRY, FALLBACK_GLM_INVOKE, FALLBACK_GLM_FAIL. |
sgw_request_latency_seconds |
Histogram | — | End-to-end request latency. |
There is no gauge for open connections, current model health state,
or budget spend. Those are reconstructed from logs and from
/v1/route/decision evidence when needed.
Example output (abridged)¶
# HELP sgw_requests_total Total requests
# TYPE sgw_requests_total counter
sgw_requests_total{model="deepseek/deepseek-v4-flash-0731",status="200"} 17
sgw_requests_total{model="deepseek/deepseek-v4-pro-0813",status="200"} 4
sgw_requests_total{model="z-ai/glm-5.2",status="200"} 1
sgw_requests_total{model="smart-router",status="403"} 1
# HELP sgw_routing_decisions_total Routing decisions
# TYPE sgw_routing_decisions_total counter
sgw_routing_decisions_total{action="ROUTE",model="deepseek_v4_flash"} 17
sgw_routing_decisions_total{action="ROUTE",model="deepseek_v4_pro"} 4
sgw_routing_decisions_total{action="SCOUT",model="nemotron_ultra"} 2
sgw_routing_decisions_total{action="FALLBACK_TRY",model="deepseek_v4_pro"} 1
sgw_routing_decisions_total{action="FALLBACK_GLM_INVOKE",model="z-ai/glm-5.2"} 1
# HELP sgw_request_latency_seconds Request latency
# TYPE sgw_request_latency_seconds histogram
sgw_request_latency_seconds_bucket{le="0.5"} 5
sgw_request_latency_seconds_bucket{le="1.0"} 14
sgw_request_latency_seconds_bucket{le="2.5"} 19
sgw_request_latency_seconds_bucket{le="5.0"} 21
sgw_request_latency_seconds_bucket{le="+Inf"} 22
sgw_request_latency_seconds_sum 38.7
sgw_request_latency_seconds_count 22
Status codes¶
| Status | When |
|---|---|
200 |
Metrics emitted. |
Scrape configuration¶
A minimal Prometheus scrape config:
scrape_configs:
- job_name: smart-gateway
metrics_path: /metrics
scheme: https
static_configs:
- targets: ['smart-openrounter.bee1x.one']
For host-local scraping:
scrape_configs:
- job_name: smart-gateway-loopback
metrics_path: /metrics
scheme: http
static_configs:
- targets: ['127.0.0.1:9600']
Suggested alerts¶
| Alert | Query | Meaning |
|---|---|---|
| High error rate | rate(sgw_requests_total{status=~"5.."}[5m]) > 0.05 |
More than 5% of requests are 5xx. |
| Privacy denials | rate(sgw_requests_total{status="403"}[15m]) > 0 |
Non-zero 403 rate; possibly a misconfigured client. |
| All-fallback path | rate(sgw_routing_decisions_total{action="FALLBACK_GLM_INVOKE"}[5m]) > 0 |
Senior solver is failing; GLM fallback in use. |
| Senior unreachable | rate(sgw_routing_decisions_total{action="FALLBACK_GLM_FAIL"}[5m]) > 0 |
Even the fallback is failing. |
These are starting points. Tune thresholds to your traffic.
Related¶
- Reference → Metrics — full metric reference.
- Architecture → Observability — log shape.