Repository navigation
feat(egress): wire kernel drop telemetry into sidecars - #3125
Open
hpliStartAgain wants to merge 1 commit into
Open
hpliStartAgain wants to merge 1 commit into
hpliStartAgain wants to merge 1 commit into
Conversation
hpliStartAgain
requested review from
Generalwin,
Pangjiping,
hittyt,
jwx0925 and
ninan-nn
as code owners
November 26, 2026 06:09
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
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.
Refs #3085
Part 2 of 3 of kernel drop telemetry. Part 1 (#3094) is merged; this PR is based on
mainand contains only the sidecar wiring.This registers the drop instruments during egress metrics initialization and documents all three in the telemetry reference, including the disabled sampler gauge exported when drop telemetry is off. Measurements retain sandbox_id and configured extra metric attributes, with closed reason/cause labels. It wires the shared library into sidecar nftables and forward enforcement, adds explicit reason/protocol mappings and frozen off-mode rule snapshots, and records sampled blocked-IP audit events. Counter reads complete before remaining DNS leases are planned and are serialized through replacement submission; a slow read cannot restore an expired lease with a stale positive timeout. Existing drop matches and verdicts are retained; default-off runner scripts remain byte-for-byte unchanged.
The three telemetry inputs (mode, rate, and counter poll) are added to the lifecycle server egress allowlist, with both Docker and Kubernetes split/injection tests. Sidecars may enable counter or sample mode through request env. Sidecar usage and mechanism pages, including the
nft -jand NFLOG requirements, are registered in the docs sidebar. Fast Sandbox remains unwired in this part and is added in PR1c.Configuration has three environment inputs:
OPENSANDBOX_EGRESS_DROP_TELEMETRY,OPENSANDBOX_EGRESS_DROP_LOG_RATE, andOPENSANDBOX_EGRESS_DROP_COUNTER_POLL. NFLOG group is fixed at 3085 per network namespace, and the per-rule burst is derived asclamp(2 × N, 1, 1000)from the rate count N; the default remains 40 and1/daygives 2. Docker and Kubernetes tests also assert that the removed group/burst settings are outside the allowlist.Validation: Go1.26.11 full gofmt/vet/build, affected packages pass normally and with
-race. Linux private-netns library and sidecar ruleset tests pass with-race, including delete-only removal. Server: 397 tests pass and scoped ruff lint passes. Docs build succeeds. This part is +733/-7 across 25 files.No new dependency beyond PR1a. Counters and samples remain best effort; kernel compatibility matrices, high-rate sample-loss behavior, production end-to-end behavior and an image build are not established by these checks. The library shutdown fallback limitations from PR1a remain applicable. Scan detection, quarantine and webhooks remain outside this stack.
Previously identified file-level overlap with still-open #3020: the egress workflow and privileged-runner tests,
components/egress/main.go,pkg/telemetry/metrics.go, the VitePress config, egress architecture/telemetry pages, and the server constants/Docker/Kubernetes test files. No enforcement-anchor logic is included.🤖 Generated with Claude Code