Repository navigation
feat(nat): Count NAT translations and shard state - #847
Merged
Merged
Conversation
A shard reported its drops, session table and uplink queues, but nothing
it translated successfully, so a drop ratio could not be computed and a
shard that stopped receiving traffic read the same as an idle one.
Whether it was attached, programmed or covering every uplink showed only
in its logs.
- nat_traffic, a per-CPU array of 8 slots (family x direction x
action), counts every packet a leg translates as it leaves, in one
slot update. Messages the shard sends on its own behalf and packets
it passes on unclaimed are not counted.
- galactic_nat_packets_total and galactic_nat_bytes_total export it,
bytes being the translated IP packet without Ethernet or the SRv6
outer header.
- A state collector, registered whether or not the datapath is on,
exports datapath_enabled, datapath_attached, programmed,
uplink_covered{interface}, family_enabled{family} and info.
- Alerts: GalacticNatNotProgrammed, GalacticNatUplinkUncovered,
GalacticNatForwardDropRatio and GalacticNatNotTranslating, with
promtool tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
privateip
force-pushed
the
feat/nat-translated-traffic-metrics
branch
from
October 12, 2026 18:27
58999ad to
7261dd4
Compare
Contributor
Author
|
New series and alerts: A failed read of the translated traffic map or the drop map is now logged and its series skipped, rather than reported as an invalid metric. The metrics server turns an invalid metric into a failed scrape of every other series, the shard's state included. While a read fails, the drop-ratio alert sees no drops for that shard. Merge order. #597 adds a map and metrics to the same NAT program and collector, and #580 and #613 edit the NAT configuration doc. Whichever lands second needs a rebase, and the infra rule copy and runbook sections should land the same day as this. Port usage, the dispatcher lease, session creation and the control loop follow in PRs stacked on this one. |
4 tasks
privateip
marked this pull request as ready for review
October 12, 2026 19:02
privateip
enabled auto-merge
October 12, 2026 19:02
scotwells
approved these changes
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An egress shard reported what it dropped but not what it translated, so on-call could not compute a drop ratio or tell a quiet broken shard from an idle one.
Whether a shard was programmed or covered all its uplinks showed only in its logs.
The shard now counts translated packets and bytes by family and direction, reports whether it is turned on, attached and programmed and which uplinks it covers, and four alerts use them, at one counter update per translated packet and at most 16 traffic series, six state series and one per uplink for each shard.
The alerts need the same change in infra's central rule copy plus four runbook sections, and the first comment lists every new series and alert and the merge order against other open PRs.
Test plan
Related to #722
🤖 Generated with Claude Code