Metrics
The gateway exposes Prometheus metrics when metrics.enabled is true.
Deep dive:
- Metrics registry wrapper: Registry
- Protocol metrics collectors: Protocol metrics
See also:
- Architecture: Observability
- Guide: Troubleshooting
Endpoint
Mounting is done by the server/runtime. The handler is built by:
pkg/gateway/metrics.(*Registry).Handler
Exported metrics
All protocol metrics are labeled by:
protocol:http,websocket,sse,grpc, orunknownproduct: derived fromX-Router-Productor URL prefixes (e.g.trade,task,unknown)
gateway_protocol_requests_total
Counter of proxied requests labeled by:
protocolproductoutcome(successorerror)
gateway_protocol_inflight
Gauge of in-flight proxied requests labeled by:
protocolproduct
gateway_protocol_request_duration_seconds
Histogram of upstream request duration labeled by:
protocolproduct
gateway_protocol_active_connections
Gauge of active long-lived connections labeled by:
protocolproduct
Notes:
- Websockets are tracked via hijack lifecycle hooks.
- SSE and gRPC are tracked as “connections” for concurrency visibility.