A3S Gateway
Observability
Prometheus metrics, structured logging, distributed tracing, and dashboard API
Observability
A3S Gateway provides built-in Prometheus metrics, structured access logging, distributed tracing, and a dashboard API.
Dashboard API
Prop
Type
Health Response
{
"state": "Running",
"uptime_secs": 3600,
"active_connections": 42,
"total_requests": 12345
}Prometheus Metrics
gateway_requests_total 12345
gateway_responses_total{status_class="2xx"} 11000
gateway_responses_total{status_class="3xx"} 500
gateway_responses_total{status_class="4xx"} 700
gateway_responses_total{status_class="5xx"} 145
gateway_response_bytes_total 987654321
gateway_active_connections 42
gateway_router_requests{router="api"} 8000
gateway_router_requests{router="web"} 4345
gateway_backend_requests{backend="http://127.0.0.1:8001"} 6000
gateway_backend_requests{backend="http://127.0.0.1:8002"} 6345Grafana Queries
# Request rate
rate(gateway_requests_total[5m])
# Error rate (4xx + 5xx)
rate(gateway_responses_total{status_class=~"4xx|5xx"}[5m])
# Success rate %
rate(gateway_responses_total{status_class="2xx"}[5m])
/ rate(gateway_requests_total[5m]) * 100
# Active connections
gateway_active_connections
# Traffic by router
rate(gateway_router_requests[5m])
# Throughput (bytes/sec)
rate(gateway_response_bytes_total[5m])Access Logging
Structured JSON access logs via the tracing crate:
{
"timestamp": "2025-01-15T10:30:00Z",
"client_ip": "203.0.113.42",
"method": "POST",
"path": "/api/v1/chat",
"status": 200,
"request_duration_ms": 145,
"bytes_sent": 2048,
"router": "api",
"service": "api-backend",
"backend": "http://127.0.0.1:8001"
}Log Levels
# Via CLI
a3s-gateway --config gateway.hcl --log-level debug
# Via environment
RUST_LOG=a3s_gateway=debug a3s-gateway --config gateway.hclProp
Type
Distributed Tracing
A3S Gateway propagates trace context across services:
- W3C Trace Context:
traceparent/tracestateheaders - B3/Zipkin:
X-B3-TraceId/X-B3-SpanIdheaders
Spans are created for request lifecycle, backend connections, and health check probes.