Skip to content

feat(cni)!: drop the OTel SDK from the CNI plugin; forward its timings to the agent (#1166) - #1185

Merged
bpalermo merged 1 commit into
mainfrom
feat/1166-cni-tracing
Oct 4, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/1166-cni-tracing

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Decision: drop the OTel SDK from the CNI plugin

The plugin's spans carried almost nothing the agent's spans lack, nothing queried them, and no incident was diagnosed from them. The cost was paid on every pod ADD and DEL: about 6 ms with a reachable collector and 2 s with an unreachable one. The one signal something does consume, the capture_divert counter, now reaches Prometheus through the agent under the same metric name and labels.

Value evidence

(a) What the plugin's telemetry carried that the agent's does not

Plugin signal (before) Already on the agent side?
cni.add_pod / cni.remove_pod spans: the client-side RPC, with pod name/namespace/container id Yes. The otelgrpc server span plus cni_server.enhance_pod / register_endpoint / xds_add_pod / envoy_ack_wait / xds_remove_pod / unregister_endpoints step spans, with the same pod attributes.
Pre-call work (netconf parse, PID/CRI lookup, netns pin) Not captured by the plugin either. The span started inside sendAddPod, after that work.
nft capture-divert time No span. It only existed as the aether.cni.operations{operation="capture_divert"} counter/histogram.
cni.readiness_probe span No. It runs after AddPod answers.
aether.cni.operations{add,del,check,gc,status} + aether.cni.operation.duration Mostly. The agent's otelgrpc rpc.server.* metrics count and time AddPod/RemovePod.

(b) Consumers. Nothing in docs/, docs/observability/, the chart, or k8s-talos-main/clusters/talos-main (Prometheus rules, rules_test, values, Grafana) references the plugin's span names (cni.add_pod, cni.readiness_probe, cni.remove_pod), its tracer (aether/cni-plugin) or its service (aether-cni). The only consumers of anything it exported:

There are no alerts and no dashboards on either.

(c) Incident history. #645 (conflist), #245 (stale netns), #484 (RESULT_IGNORED), #1094 (anyport landing), #950, #1088: zero mentions of a trace, span or Tempo across the bodies and comments. Those diagnoses came from plugin.log, agent logs and Prometheus. #950 itself was diagnosed from plugin.log, because the plugin's telemetry was the thing that was broken: it exported nothing on talos-main for weeks while each flush timed out.

Cost (measured)

//cni/cmd/cni built as-is vs. this branch. A Go harness alternated the variants each iteration (n=300, 20-core host under load) and read the child's rusage. The DEL case uses a kube-system pod: it parses the netconf, initialises telemetry, returns early, then records and flushes. That isolates the telemetry cost with no agent call.

before after delta
binary size 18,736,940 B (17.9 MiB) 15,506,732 B (14.8 MiB) −3.2 MB (−17.2 %)
linked modules 37 19 −18 (−49 %)
exec, VERSION (init only), wall p50 / CPU p50 13.85 / 15.59 ms 12.67 / 14.32 ms −1.2 / −1.3 ms
DEL, telemetry off, wall p50 14.07 ms 12.76 ms −1.3 ms
DEL, live collector (talos-main's config), wall p50 / p90 20.39 / 22.18 ms 12.76 / 13.84 ms −7.6 ms per pod ADD/DEL
same, CPU p50 / maxrss p50 23.48 ms / 18.6 MiB 14.34 ms / 14.2 MiB −9.1 ms / −4.4 MiB
DEL, collector unreachable (refused, n=30) or unresolvable (#950 shape, n=10) 2027 ms / 2026 ms p50 12.76 ms −2.0 s per pod ADD/DEL

The 2 s case is the 2 s OTLP export timeout. Flush ran before the plugin printed its result, so every pod start on talos-main waited that extra time before #950 was fixed.

What changed

  • Plugin: removed cni/internal/telemetry (SDK, OTLP trace and metric exporters), trace.go, the otelgrpc client stats handler and the instrument/Flush wrapper. It links no go.opentelemetry.io module now.
  • API (api/aether/cni/v1/service.proto, edition 2023, implicit presence, additive only):
    • PluginTimings{started, pre_call} on AddPodRequest (field 2) and RemovePodRequest (field 5);
    • a new ReportAddResult RPC for what happens after AddPod answers (readiness probe and capture divert durations and errors, plus total). The capture divert has to come after the agent's managed/ignored verdict, so it cannot ride on AddPod.
    • Backward compatible both ways: an older plugin sends no timings and no report. An older agent answers UNIMPLEMENTED, which the plugin logs at DEBUG. The report is one attempt with a 500 ms timeout and never fails an ADD.
  • Agent: records the timings as span attributes (aether.cni.plugin.{pre_call,readiness_probe,capture_divert,total}_seconds, …_error). It counts aether.cni.operations{aether.cni.operation="capture_divert", aether.cni.result} under the same name and labels the plugin exported, so the soak gate PromQL is unchanged. A failed divert also gets a WARN in the agent's log, which reaches VictoriaLogs; until now that WARN existed only in node-local plugin.log.
  • cni-install: stops writing otlp_endpoint and drops the CNI plugin OTLP metrics never reach Prometheus on talos-main: host resolver cannot resolve the collector's cluster DNS name #950 ClusterIP pinning. --otlp-endpoint / --otlp-pin-endpoint stay as deprecated no-ops for one release, so an older chart still starts a newer image. Old conflists that still carry the key are ignored, and cni-install rewrites the entry anyway.
  • Chart 2.3.0 → 2.4.0: cniInstall.otlpEndpoint / cniInstall.pinOTLPEndpoint removed. The two render tests are replaced by aether_cni_no_otlp_test (absent test).
  • Guards: //cni/cmd/cni:deps_test allow-list 37 → 19, budget 37 → 19, go.opentelemetry.io/ added to the forbidden packages, size ceiling 24 → 18 MiB. scripts/check-cni-deps.sh forbids io_opentelemetry.
  • Docs: docs/configuration.md, a new runbook troubleshooting section ("A pod started uncaptured…"), and the soak README gate (the existence proof is now capture_divert success, and the counter is per agent process). e2e/uds.sh assertion f now proves the divert outcome reaches the agent's Prometheus exporter after a fresh managed-pod ADD, with no error series and no otlp_endpoint in the netconf. The suite's collector is gone.

Lost

The plugin's own count of ADDs that never reached the agent (agent down). These remain visible as the kubelet's FailedCreatePodSandBox event and in plugin.log. Nothing consumed the plugin-side add error series.

Tests

  • bazel test --config=race over //cni/... and //agent/internal/cni/...: pass. New tests: cni/internal/plugin/timings_test.go and agent/internal/cni/server/pluginreport_test.go.
  • The 82 test targets that are reverse deps of the changed proto, cni/config, cni/internal/install, common/telemetry and the chart: pass.
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: clean.
  • make format-check, make gazelle, scripts/check-cni-deps.sh: clean. make deps-audit: OK (go.mod unchanged).
  • kind e2e/uds.sh (up + verify): all assertions passed, including the rewritten (f): the netconf has no otlp_endpoint, a fresh managed ADD grew the agent's capture_divert success count 5 -> 6, and there is no error series. The node's plugin.log has 0 failed to report and 0 otel/flush lines.

Fixes #1166

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…s to the agent (#1166)

The plugin linked the OTel SDK, the OTLP trace/metric exporters and otelgrpc
(18 of its 37 modules, 3.2 MB) and flushed them before every exit. Measured per
pod ADD/DEL: +7.6 ms wall p50 with a reachable collector, +2.0 s with an
unreachable or unresolvable one (the #950 state). Nothing queried its spans, and
no incident was diagnosed from them. The one consumed signal, the capture-divert
counter (the soak gate), now reaches Prometheus through the agent under the same
name and labels.

- api/aether/cni/v1: additive PluginTimings{started, pre_call} on AddPod and
  RemovePod, plus a ReportAddResult RPC for the post-AddPod readiness probe
  and capture divert. An older agent answers UNIMPLEMENTED (ignored); an older
  plugin sends nothing.
- agent: records the timings as span attributes, counts
  aether.cni.operations{capture_divert}, and WARNs on an uncaptured pod.
- cni-install: writes no otlp_endpoint; --otlp-endpoint/--otlp-pin-endpoint
  become deprecated no-ops for one release.
- chart 2.4.0: cniInstall.otlpEndpoint / pinOTLPEndpoint removed.
- deps_test allow-list and budget 37 -> 19, OTel forbidden, ceiling 18 MiB.

Fixes #1166

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo force-pushed the feat/1166-cni-tracing branch from f120876 to fb5f04f Compare October 4, 2026 11:10
@bpalermo
bpalermo merged commit 309b5d3 into main Oct 4, 2026
24 checks passed
@bpalermo
bpalermo deleted the feat/1166-cni-tracing branch October 4, 2026 11:22
bpalermo added a commit that referenced this pull request Oct 4, 2026
…from the last two days (#1235)

- proxy-supervisor: drop "15 MiB / 24 modules" (it links 25 since the OTel
  1.47 bump, #1215) and name deps_test + check-proxy-supervisor-deps.sh as
  the source of truth; that guard asserts forbidden packages and a size
  ceiling, not a count.
- cni: the allow-list budget is 19, not 37 (#1185). Point at the guard's
  maxModules instead of repeating it; the build-graph script now forbids
  OpenTelemetry too. The plugin forwards timings to the agent.
- mesh-dns: same wording (its guard asserts 30, still correct).
- cni/internal: telemetry/ was removed by #1185.
- registrar/internal/server: the snapshot version is store revision +
  content hash since #1204.
- Add agent/internal/ownership (proposal 041), common/drain,
  common/referencegrant, and common/taint (in the node-taint entry).

Fixes #1224


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Fable 5.1 <[email protected]>
bpalermo added a commit that referenced this pull request Oct 9, 2026
…onger report their pod name as host.name, and the otel.endpoint row no longer names the CNI plugin (#1596, #1614) (#1618)

common/telemetry/setup kept the OTel host detector for every component
built on it. The node agent is hostNetwork, so its host.name is the
node's. The registrar, the controller and the edge control plane are on
the pod network, so theirs was the pod name: the resource #1041 fixed
for the prober, where a collector promoted host.name to the node label
ahead of k8s.node.name.

The package is shared by both kinds, so it cannot choose. setup.Config
and manager.Config gain WithoutHostName (zero value: host.name kept, as
before), and the three components that are not hostNetwork set it:
NewRegistrarConfig, NewControllerConfig, and the edge in the
PersistentPreRunE it shares with the node agent (applyEdgeTelemetry,
agent/internal/cmd/edge.go), before the logger's provider is built.

manager.Config.Telemetry is now the one mapping from a component's
manager configuration to its telemetry setup; the logger's provider used
a second, shorter literal. setup.NewResource is exported so each
component pins its own resource in its own package.

Docs: metric-labels.md says which component sets host.name;
configuration.md and getting-started.md no longer say the collector
endpoint is baked into the CNI plugin, which exports no telemetry of its
own since #1166/#1185.


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Opus 5.5 <[email protected]>
bpalermo added a commit that referenced this pull request Oct 10, 2026
…re of TCP and UDP, HTTP/3 between proxies, outcome-based retries, UDS over CSI, the surge-rolled agent (#1648)

The architecture page is README.md and the landing page is
website/pages/index.md; neither mentioned transparent capture, QUIC, UDP, L4
routes, the edge, retries or the data-plane ports.

README.md (the site's Architecture page)
- Intro and diagram: the CNI's TPROXY-style divert of TCP and UDP, the
  transports of a mesh hop (HTTP/3 over QUIC, HTTP/2, TCP; UDP in plaintext),
  the uds-csi node plugin.
- New paragraphs: transparent capture, transport between proxies, retries,
  edge gateway, multi-cluster, data-plane ports. The agent paragraph names the
  ownership lock and the opt-in surge roll; the Gateway API paragraph names the
  L4 route types and the authz sidecar.
- The CNI plugin exports no telemetry of its own (#1185); the observability
  paragraph said it did.

website/pages/index.md (landing page)
- "What it does today", eight entries, each linked to its doc or proposal.
- The hot-restart cell said the agent supervises Envoy (it is the proxy
  supervisor since #772) and claimed zero drops measured by the prober; it now
  quotes proposal 042's write-up of the soak, the prober's mesh-DNS timeouts
  included.
- The install block names the SPIRE prerequisite and the four privileged
  DaemonSets, as docs/getting-started.md does.

docs
- getting-started.md: the east-west QUIC text was a bullet of the edge
  section; it is its own subsection under "Call other services"
  (#east-west-quic), unchanged in content. The edge section gains the HTTP/3
  switch (edge.config.http3.enabled, default off). The model diagram and its
  bullets name HTTP/3.
- workload-requirements.md: one paragraph on what carries a request between
  proxies.
- runbook.md: one per-pod cluster name spelled without its namespace (#1634).

Site plumbing
- docs/observability/metric-labels.md is staged as /docs/metric-labels/ and is
  in the nav; three staged pages linked it on GitHub.


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cni: the plugin binary links the OTel SDK and OTLP exporters (~13–15 of its 37 modules) in a process run on every pod start/stop

1 participant