Repository navigation
feat(nat): Report port usage and dispatcher lease - #848
Conversation
|
New series and alerts: Why per destination. A reverse session row is keyed by the reply as it arrives, so a masquerade port is claimed per destination address and port, and a claim probes 8 of the 28000 candidates. Ports held across all destinations can sit near the range on a healthy shard, so the alert reads the busiest destination instead. With a share u of that destination's ports held, a new flow fails with probability about u^8, which is 0.4% at half full and 17% at 80%, so the warning sits at half full. Why the expiring alert reads the renewal counter. The expiry timestamp is the node's wall clock, and comparing it with the evaluator's time() would page on clock skew alone. The alert fires when no renewal has succeeded for a minute and a half, about 30 seconds before the 120-second lease lapses. The dispatch lease series exist only in dispatch mode. |
46a4b73 to
24b492a
Compare
GalacticNatPortExhausted fires only once new flows are already failing, and a dispatcher lease that stopped renewing showed only in an error log until the slot lapsed and the shard passed traffic untranslated. A masquerade port is claimed per destination address and port, and a claim probes 8 candidates, so exhaustion is a property of the busiest destination, not of the address as a whole. The session table walk now reports, per family, masquerade address and protocol, the distinct ports held and the most held toward one destination, against the range, with every served address reported at zero. The lease loop is shared by galactic-nat and galactic-gateway, so its metrics live in xdpdispatch and each binary registers them under its own namespace. Lease now reports every renewal's result, success included. Alerts: GalacticNatPortsNearExhaustion at half the range toward one destination, GalacticNatDispatchLeaseFailing and GalacticNatDispatchLeaseExpiring, with promtool tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24b492a to
fce3d6d
Compare
Summary
On-call learned a shard was out of masquerade ports only once new connections were already failing, and learned its dispatcher lease had stopped renewing only when the shard began passing traffic untranslated.
Shards now report, for each masquerade address and protocol, how many ports are held and how many toward the busiest single destination, which is what runs out first, and both the shard and the edge gateway report every lease renewal and when the lease expires, with three alerts on them.
Nothing changes on the packet path: port usage comes from the session table walk each scrape already does, and the lease series cost three per dispatcher slot, while the port series cost six per masquerade address plus one.
This is stacked on #847, and infra's central rule copy needs the three alerts and their runbook sections too.
Test plan
Related to #722
🤖 Generated with Claude Code