resctrl-mon: OTel telemetry via goresctrl pkg/monitor #757
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #757"
general
weight: 0.35
marquiz
Description
This PR reworks the
resctrl-monNRI plugin to manage per-pod resctrl monitoring groups (mon_groups) withgoresctrl/pkg/monitor(goresctrl v0.14.0). Their counters are exported through an embedded OpenTelemetry SDK. This replaces the plugin's inline resctrl handling (resctrl.go,state.go).Commits
1.
resctrl-mon: OTel telemetry via goresctrl pkg/monitor: the plugin, its docs and the sample config.2.
resctrl-mon: Helm chart telemetry configuration: chart values, templates and README.3.
resctrl-mon: reference OTel collector and Grafana dashboards: optional assets that are applied by hand.4. Hardening, telemetry, and coexistence updates:
- Reserving labels derived by OTLP-to-Prometheus translation and rejecting collisions.
- Ignoring dead sandboxes at sync on containerd.
- Reading RDT class from
Linux.Rdt.ClosIdand implementing pod-level class selection.- Defaulting AppArmor profile to
Unconfinedin the Helm chart.- Defaulting OTLP export to TLS, Prometheus PodMonitor support, and packaging cleanup.
Plugin behavior
- The group is created in
PostCreateContainer.- The container's init PID is written in
StartContainer, withPostStartContaineras a fallback.- The group is removed only when the pod's last sandbox is removed. Kubelet also garbage-collects older sandboxes of a still-running pod (same UID, for example after a node reboot or pause-container death), so the plugin tracks sandbox IDs per pod.
- Container stops never release the RMID, which avoids residual-counter energy spikes when a container restarts.
-
getRDTClassreadsLinux.Rdt.ClosId(populated from OCIlinux.intelRdt.closIDby runtimes), falling back toLinux.Resources.RdtClass. (Note: upstreammainhas this same bug, reading onlyLinux.Resources.RdtClass, which CRI runtimes do not set).- The pod's monitoring group class is determined by the pod-level annotation
rdt.resources.beta.kubernetes.io/pod(falling back to the first arriving container's class if absent).- Containers whose class differs from the pod's group (such as an off-class sidecar) do not have their PID assigned to the pod's
mon_group, preserving their CAT/MBA allocation in their respective class.Synchronizeremoves groups left behind by a previous process, adopts live groups under their on-disk class, and a background reconciler retries failed removals.mon_groupmanagement.Metric names
Names are pinned to the
UnderscoreEscapingWithSuffixestranslation strategy:l3_llc_occupancy_bytesl3_mbm_local_bytes_totall3_mbm_bytes_totalperf_core_energy_joules_totalperf_activity_farads_totalThe metric table and label list are in
docs/monitoring/resctrl-mon.md.With goresctrl v0.14.0,
perf_activity_farads_totalis in true farads. The kernel reports nanofarads, so values are 1e9 times smaller than before this bump, and the dashboards use SI-prefixed units.Helm chart and security configuration
appArmorProfile: {type: Unconfined}(rendered assecurityContext.appArmorProfileon Kubernetes ≥ 1.30, and viacontainer.apparmor.security.beta.kubernetes.io/nri-resctrl-monannotation on < 1.30).- Cause: containerd's
cri-containerd.apparmor.dand CRI-O'scrio-defaultAppArmor profiles deny writes under/sys/fs/[^c], which silently blocks resctrl manipulation despiteCAP_SYS_ADMINwhile the plugin container stays Ready.- Note:* Other plugins granting resctrl capabilities (
balloons,topology-aware) are likely similarly affected when RDT is enabled.toYaml, PrometheusPodMonitorresource support, andNODE_NAMEinjected for thek8s.node.namelabel.optional/directory:- Reference OTel Collector agent DaemonSet and Grafana dashboards for cluster deployment.
Testing
go build ./...,go vet,gofmt -l,golangci-lint,helm lint, andgo test -race -count=1 ./cmd/plugins/resctrl-mon/...pass.- Validated using the integration test suite (resctrl-mon-tests):
- containerd: 145/145 lifecycle tests PASS.
- CRI-O: 103/103 lifecycle tests PASS.
- RDT class pods & sidecars: L5 and L6 PASS on both runtimes in both container creation orders (main first and sidecar first). The pod group is placed in
itgold, the main PID joins, and theitbronzesidecar PID is isolated in class tasks.- Runtime switching (R8): Verified live transition from containerd to CRI-O and back with active workloads.
- Node reboot (R9): Verified group reconstruction after host reboot on containerd.
- AppArmor: Confirmed plugin runs
unconfinedand successfully writes resctrl groups on both runtimes.Known Coexistence & Runtime Limitations
rdt_config_filecallrdt.Initialize("")at startup, pruning unknown ctrl groups and empty mon_groups. Pods without running containers (Completed, in backoff) lose theirmon_group, RMID, and counter continuity. Hand-made ctrl groups should not be maintained on hosts with runtime RDT management enabled.v2.3.2andmain),internal/nri/nri.gostate tracking gatesStopPodSandboxandRemovePodSandboxon in-memorylocal.state, whichsyncPluginpopulates only for containers, not sandboxes. Consequently, pods surviving across containerd restarts do not emitStopPodSandboxorRemovePodSandboxto NRI plugins when deleted. The plugin retains the pod'smon_groupuntil the next plugin restart/sync. (Verified with thecontainerd/nrilogger plugin).Follow-ups (separate PRs)
install-pluginsMakefile target.values.schema.jsontelemetry block.