Repository navigation
fix(node-metrics): count only pod uplinks, include native sidecars, cache owner misses - #1443
Merged
Merged
Conversation
…ache owner misses - sum traffic only over eth<N> (CNI) and net<N> (Multus): in pods with a nested runtime (docker-in-docker, kind) the bridges and veths carry the same traffic as eth0, which was counted two or three times; this also covers the /proc/net/dev fallback and old snoopy versions - read initContainerStatuses too: native sidecars (restartPolicy Always, e.g. dind or a mesh proxy) were missing from per-process cpu/memory stats; exited init containers have no processes and drop out - cache pods without owner and pods with an unsupported owner kind (EphemeralRunner, AutoscalingListener, Sandbox, ...): node-metrics loaded the full pod from Valkey for each of them every minute Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
beneiltis
force-pushed
the
fix/node-metrics-uplinks-sidecars
branch
from
November 13, 2026 13:00
791608b to
ac737d6
Compare
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.
Found by running node-metrics with
MO_LOG_LEVEL=debugon homeserver (develop.856) for a few minutes.Changes
Count only pod uplinks (
networkmonitor.go,snoopy.go)An ARC runner pod runs docker-in-docker as a native sidecar; its netns has
docker0and one veth per job container.metricsToPodstatssummed every interface exceptlo, so traffic of a job container (veth → docker0 → eth0) was counted two or three times. Traffic is now summed overeth<N>(CNI; containerd numbers extra networks eth1, …) andnet<N>(Multus) only. This applies to snoopy and/proc/net/devdata alike and works with any snoopy version. mogenius/snoopy#173 additionally stops snoopy from attaching to those inner interfaces.Native sidecars (
podinfo.go,store/podsonnode.go)NewPodInfoListonly readcontainerStatuses. Native sidecars (init containers withrestartPolicy: Always, e.g. the dind sidecar here, or Istio/Linkerd in native sidecar mode) only appear ininitContainerStatuses, so their processes were missing from the per-process cpu/memory stats. Both lists are read now; exited regular init containers have no processes and drop out in the process lookup. The slim pod view decodesinitContainerStatusesas well.Owner cache misses (
store/ownercacheservice.go)Every minute
AddInterfaceStatsToDbresolves each pod's controller. Pods without owner and pods owned by kindsOwnerFromReferencedoes not handle (EphemeralRunner,AutoscalingListener,Sandbox, …) were never cached, so each of them loaded the full pod from Valkey every minute. Both results are cached now (cleared on pod delete as before). Supported kinds that fail to resolve are still not cached, their owner may just not be in the store yet. Return values are unchanged.Verification
go build ./...,go vet, unit tests andgolangci-lintclean. Not yet deployed.🤖 Generated with Claude Code