Skip to main content

Metrics and health

Prometheus metrics​

Exposed on METRICS_PORT (9000 by default):

MetricLabelsDescription
nirn_proxy_errornoneError counter
nirn_proxy_requestsmethod, status, route, clientIdHistogram of every request
nirn_proxy_open_connectionsroute, methodOpen client connections with the proxy
nirn_proxy_requests_routed_sentnoneRequests routed to other nodes
nirn_proxy_requests_routed_receivednoneRequests received from other nodes
nirn_proxy_requests_routed_errornoneRouted requests that failed
nirn_proxy_invalid_requestsstatusResponses Discord counts as invalid: 401, 403, and 429 outside the shared scope
nirn_proxy_invalid_requests_windownoneInvalid 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.