Repository navigation
feat: kubelet usage poller with counter deltas and window snapshots - #14
Merged
Merged
Conversation
Implements the collection layer of ADR 0006 for CPU and memory: - UsagePoller polls every node's kubelet through the API server proxy (get nodes/proxy, /stats/summary only in this slice) every 30 s and reduces samples into the rollup accumulator - delta rules per ADR 0006: deltas from kubelet response timestamps, re-served snapshots discarded, counter resets rebaseline without a sample, first observation counts from container start - PodWatcher gains a UID index for sample attribution; excluded pods are dropped before accumulation, unknown pods defer losslessly - NodeWatcher tracks the live node name set as the polling target list - open-window snapshots ship once a minute with a monotonic sequence number; closed windows emit final records; coverage now reports the active usage signal set - security.md §3/§5: usage collection goes through the API server proxy — the agent opens no direct connection to kubelets Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 9, 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.
Second of three ADR 0006 slices: actual collection of CPU and memory usage, end-to-end from kubelet to logged rollup snapshots. Builds on the rollup core from #13; the cAdvisor throttling counters and PSI probing come in slice 3.
What's here
UsagePoller(internal/collector/usage.go): polls every node's kubelet through the API server proxy (get nodes/proxy) every 30 s — exactly one path in this slice,/stats/summary. CPU comes from the cumulativeusageCoreNanoSecondscounter (exact regardless of cadence), memory from the working-set gauge.PodWatchergains a UID → (namespace, workload) index containing only admitted pods. Excluded pods' samples are dropped at the source; unknown pods (informer lag) defer losslessly — the baseline isn't advanced, so the next attributed observation covers the full interval.usage_signals— which kubelet signals this cluster actually exposes (cpu,memorynow;throttling,psiin slice 3).Tests
ingest()with hand-built summaries.test/e2e/usage_test.go): full pipeline against kind with a CPU-burning deployment under a 300m limit; asserts accumulated core-nanoseconds, sane sampled rates, hour-aligned windows. Makefile e2e timeout bumped 10m → 15m.New dependency:
k8s.io/kubelet(stats API types only).🤖 Generated with Claude Code