Skip to content

Stats Reference

bilbycast-relay exposes structured statistics on GET /api/v1/stats (in addition to the Prometheus metrics on GET /metrics). The structured endpoint is the right one to consume from a custom dashboard or monitoring script — it gives you the same numbers in a single JSON response without the overhead of scraping a Prometheus exposition.

This page documents every field in that response.

Auth: Required when api_token is configured (Bearer token).

Response: A single JSON object.

{
"uptime_secs": 86400,
"connected_edges": 16,
"total_tunnels": 9,
"active_tunnels": 8,
"total_bytes_ingress": 1234567890,
"total_bytes_egress": 1234567890,
"total_bytes_forwarded": 2469135780,
"total_bandwidth_bps": 490000000,
"total_tcp_streams": 4200,
"active_tcp_streams": 12,
"total_udp_datagrams": 1500000,
"peak_tunnels": 12,
"peak_edges": 20,
"connections_total": 24
}

The per-tunnel breakdown is served separately on GET /api/v1/tunnels.

This is a single flat JSON object. All counters are lock-free atomics, cumulative since process start unless noted otherwise.

FieldTypeMeaning
uptime_secsu64Seconds since the relay process started
connected_edgesusizeNumber of edges currently connected to the relay
total_tunnelsusizeNumber of tunnels currently tracked (active + pending)
active_tunnelsusizeNumber of tunnels currently bound on both legs
total_bytes_ingressu64Total bytes received from ingress edges across all tunnels
total_bytes_egressu64Total bytes sent to egress edges across all tunnels
total_bytes_forwardedu64Sum of ingress + egress bytes
total_bandwidth_bpsu64Current forwarding bandwidth, derived from the byte counters over a sliding window
total_tcp_streamsu64Total TCP streams forwarded since startup
active_tcp_streamsu64TCP streams currently being forwarded
total_udp_datagramsu64Total UDP datagrams forwarded
peak_tunnelsu64Maximum concurrent active tunnels observed
peak_edgesu64Maximum concurrent connected edges observed
connections_totalu64Total QUIC connections accepted since startup
managerobjectManager-link state. Omitted entirely when no manager is configured
Terminal window
curl -s -H "Authorization: Bearer $RELAY_TOKEN" \
http://relay.example.com:4480/api/v1/stats \
| jq '.active_tunnels'
Terminal window
curl -s -H "Authorization: Bearer $RELAY_TOKEN" \
http://relay.example.com:4480/api/v1/tunnels \
| jq '.tunnels[] | {tunnel_id, ingress: .stats.bytes_ingress, egress: .stats.bytes_egress}'
Terminal window
curl -s -H "Authorization: Bearer $RELAY_TOKEN" \
http://relay.example.com:4480/api/v1/stats \
| jq '(.total_bytes_forwarded / .total_udp_datagrams)'

Every field on this endpoint has a Prometheus counter or gauge on GET /metrics. Use the structured endpoint for one-off scripts and the Prometheus endpoint for time-series storage. Both read from the same atomics, so the numbers always agree.