Skip to content

v0.2.14-rc

Pre-release
Pre-release

Choose a tag to compare

@McSim85 McSim85 released this 11 May 19:54
Add listen_port and device tags to receiver_stats metric

The `shredstream_proxy-receiver_stats` metric currently keys solely on
source IP. When the proxy listens on UDP :20000 for Jito BE / mesh unicast
AND on UDP :7733 for DZ multicast via `doublezero1`, packets from a source
IP that arrives on both paths collapse into a single metric row, making it
impossible to measure DZ multicast's contribution separately.

This change adds two InfluxDB tags to each receiver_stats row:

- `listen_port` — the local UDP port the packet arrived on (e.g. `20000`
  for unicast, `7733` for multicast)
- `device` — `"unicast"` for non-multicast sockets, or the configured
  `--multicast-device` (e.g. `doublezero1`) for the multicast socket

`(listen_port, device)` is constant per send_thread (one socket per
thread), so we capture `listen_port` from `socket.local_addr()` at thread
setup and derive the `device` tag from port + ShredMetrics fields at
report time. Device is not stored in the DashMap key to avoid per-packet
Arc cloning.

A startup `info!` log per socket prints the (listen_port, device) mapping
so operators can confirm the labels before querying InfluxDB.

Backward-compatible: queries that aggregate only by `addr` continue to
work. Cardinality increase is trivial (~2x ports × ~2 device values).

Also fixes a pre-existing macOS-only flake in `test_2shreds_3destinations`
by using `127.0.0.1` instead of `0.0.0.0` for the test listeners (UDP
send-to-`0.0.0.0` doesn't loopback to a `0.0.0.0`-bound listener on
macOS, only on Linux).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>