Repository navigation
cpu: Add NUMA node mapping metric - #3785
Open
baozhuoran wants to merge 2 commits into
Open
baozhuoran wants to merge 2 commits into
baozhuoran wants to merge 2 commits into
Conversation
added 2 commits
November 10, 2026 15:03
Temporary replace directive pointing at prometheus/procfs#892. Drop this commit and bump github.com/prometheus/procfs once a release contains sysfs.FS.NUMANodeCPUList. Signed-off-by: Zhuoran-Bao <zhuoran.bao@ibm.com>
Add node_cpu_numa_info{cpu,node}, which exposes the NUMA node of each
online CPU as read from /sys/devices/system/node/node*/cpulist via
procfs. It allows counting CPUs per NUMA node and aggregating per-CPU
metrics such as node_cpu_seconds_total by NUMA node. Systems without
NUMA nodes and memory-only nodes expose no series.
Signed-off-by: Zhuoran-Bao <zhuoran.bao@ibm.com>
baozhuoran
force-pushed
the
numatopology-collector
branch
from
November 10, 2026 20:05
906c8a7 to
2081194
Compare
baozhuoran
marked this pull request as ready for review
November 10, 2026 20:46
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.
Summary
Add
node_cpu_numa_info{cpu,node}to thecpucollector. It exposes the NUMA node of each online CPU, read from/sys/devices/system/node/node*/cpulistthrough procfs. It depends on prometheus/procfs#892; see Dependency below.This PR was reworked. The first version added a standalone
numatopologycollector that also parsed libvirt domain XML. That part is dropped: it was service data read from outside/procand/sys, and its per-node memory metric duplicatednode_memory_numa_MemTotal.Motivation
node_exporter exposes per-NUMA-node memory (
meminfo_numa), but nothing says which CPUs belong to which NUMA node. With this mapping:count by (instance, node) (node_cpu_numa_info)sum by (instance, node, mode) (rate(node_cpu_seconds_total[5m]) * on (instance, cpu) group_left(node) node_cpu_numa_info)Notes
node_memory_numa_*, rather than the sample value, as innode_pcidevice_numa_node. A label can be joined onto per-CPU series.node_cpu_online, so there is no new flag.cpulist, and memory-only nodes have no CPUs, so neither produces a series.Dependency
This needs
sysfs.FS.NUMANodeCPUListfrom prometheus/procfs#892, which is not merged yet, so this PR can't be merged as it is. The first commit is a temporaryreplacedirective pointing at that branch so that CI can run. Once a procfs release contains the helper, I'll drop that commit and bump procfs instead. The collector change itself is ready for review.Testing
TestCPUNUMAInfo, which uses the existingfixtures/sysNUMA nodes (node00-1, node12-3, node2 memory-only).e2e-output.txtande2e-64k-page-output.txtwith./end-to-end-test.sh -u.-race),golangci-lintandmake checkmetricspass locally on Linux../end-to-end-test.shpasses on x86_64 and arm64.nodeN/cpulistand cover the same CPUs asnode_cpu_seconds_total. A sysfs tree withoutdevices/system/nodegives no series and no collector error.