Metrics and health
Prometheus metrics
Exposed on METRICS_PORT (9000 by default):
| Metric | Labels | Description |
|---|---|---|
nirn_proxy_error | none | Error counter |
nirn_proxy_requests | method, status, route, clientId | Histogram of every request |
nirn_proxy_open_connections | route, method | Open client connections with the proxy |
nirn_proxy_requests_routed_sent | none | Requests routed to other nodes |
nirn_proxy_requests_routed_received | none | Requests received from other nodes |
nirn_proxy_requests_routed_error | none | Routed requests that failed |
nirn_proxy_invalid_requests | status | Responses Discord counts as invalid: 401, 403, and 429 outside the shared scope |
nirn_proxy_invalid_requests_window | none | Invalid requests over the last ten minutes |
A 429 shows up with one of two statuses: 429 Too Many Requests, or 429 Shared when Discord answers with the x-ratelimit-scope: shared header. The latter do not count toward Cloudflare's firewall limit: do not use them for alerts.
Invalid requests
Discord temporarily bans an IP address that sends 10,000 invalid requests in ten minutes. nirn_proxy_invalid_requests_window tracks that count continuously, and the proxy logs a warning from 5,000, then at every further thousand: this is the metric to watch first. The repository ships a Grafana dashboard in grafana-dash.
Health
The /nirn/healthz endpoint answers liveness and readiness probes, on Kubernetes for example.
Profiling
With ENABLE_PPROF set to true, the proxy exposes pprof on http://ip:7654/debug/pprof/. That port listens on every interface, whatever BIND_IP says: only turn it on in a private network.