FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add resctrl collector by rtreffer · Pull Request #3797 · prometheus/node_exporter · GitHub

Add resctrl collector - #3797

Open
rtreffer wants to merge 1 commit into
prometheus:masterfrom
rtreffer:resctrl-collector
Open

rtreffer wants to merge 1 commit into
prometheus:masterfrom
rtreffer:resctrl-collector

Conversation

rtreffer commented Aug 26, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Expose the Linux resctrl monitoring counters (Intel RDT, AMD PQoS, ARM MPAM): per L3 domain memory bandwidth (mbm_total_bytes, mbm_local_bytes) and last level cache occupancy (llc_occupancy). Parsing is done by the procfs resctrlfs package.

The collector is disabled by default because the resctrl filesystem must be mounted first (mount -t resctrl resctrl /sys/fs/resctrl). The mountpoint is configurable via --collector.resctrl.path.

Counters a CPU does not support (for example mbm_local_bytes on Arm MPAM) or that read "Unavailable" are skipped per sample. The hardware counters wrap; Prometheus treats the wrap as a counter reset, so no correction is applied.

Depends on a procfs release that contains the resctrlfs package (prometheus/procfs#862).

Signed-off-by: René Treffer treffer@measite.de

Reviewers

AI disclosure: This code was written with the help of AI.
I have read through the code and verified that it works

Here is a snippet showing the metrics as exported by node_exporter built against prometheus/procfs#862

# HELP node_resctrl_llc_occupancy_bytes Last level cache bytes occupied in this domain.
# TYPE node_resctrl_llc_occupancy_bytes gauge
node_resctrl_llc_occupancy_bytes{domain="0"} 3.2014336e+07
node_resctrl_llc_occupancy_bytes{domain="1"} 2.3003136e+07
# HELP node_resctrl_memory_bandwidth_bytes_total Bytes moved between the last level cache and memory. scope=total includes remote sockets, scope=local is memory attached to this domain.
# TYPE node_resctrl_memory_bandwidth_bytes_total counter
node_resctrl_memory_bandwidth_bytes_total{domain="0",scope="local"} 9.866260884132983e+18
node_resctrl_memory_bandwidth_bytes_total{domain="0",scope="total"} 1.8399210738624e+13
node_resctrl_memory_bandwidth_bytes_total{domain="1",scope="local"} 5.010254585456994e+18
node_resctrl_memory_bandwidth_bytes_total{domain="1",scope="total"} 4.003923930496e+12

You can use sum by (instance,node) (rate(node_resctrl_memory_bandwidth_bytes_total{scope="total"}[1m])) to get an estimate of the data transferred between memory and CPU.

This is particularly interesting for workloads like CPU inference, in-memory databases or vector databases.

Caveats: The total value is only available if memory access happened. The metric won't be available on every scrape. We could cache the latest value if this is an issue.

Copy link
Copy Markdown
Contributor Author

Build error seems unrelate.

collector/runit.go:22:2: github.com/prometheus-community/go-runit@v0.1.0: read "https://proxy.golang.org/github.com/prometheus-community/go-runit/@v/v0.1.0.zip": stream error: stream ID 59; INTERNAL_ERROR; received from peer
!! command failed: build -o .build/darwin-amd64/node_exporter -ldflags -X github.com/prometheus/common/version.Version=1.12.1 -X github.com/prometheus/common/version.Revision=a7efcaa694b0a9b63576ba5218c51e67c41c9a71 -X github.com/prometheus/common/version.Branch=HEAD -X github.com/prometheus/common/version.BuildUser=root@f0de7527c217 -X github.com/prometheus/common/version.BuildDate=20260827-20:09:54  github.com/prometheus/node_exporter: exit status 1
make: *** [Makefile.common:237: common-build] Error 1
!! the main builder docker image exited unexpectedly: exit status 2
Error: Process completed with exit code 1.

The following diff is likely unacceptable at the moment but we need the next tagged procfs version :-)

-	github.com/prometheus/procfs v0.21.1
+	github.com/prometheus/procfs v0.21.2-0.20260827102831-a87803ee31e3

rtreffer marked this pull request as ready for review August 27, 2026 20:17

Copy link
Copy Markdown
Member

The following diff is likely unacceptable at the moment but we need the next tagged procfs version :-)

Need git rebase.

rtreffer commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@dongjiang1989 rebased. diff looks good, procfs is at a tagged version, the Mac OS test needs a rerun.

Copy link
Copy Markdown
Member

@dongjiang1989 rebased. diff looks good, procfs is at a tagged version, the Mac OS test needs a rerun.

U can git commit --amend

rtreffer force-pushed the resctrl-collector branch 7 times, most recently from afb1527 to 1324402 Compare September 21, 2026 12:06
Expose the Linux resctrl monitoring counters (Intel RDT, AMD PQoS,
ARM MPAM): per L3 domain memory bandwidth (mbm_total_bytes,
mbm_local_bytes) and last level cache occupancy (llc_occupancy).
Parsing is done by the procfs resctrlfs package (procfs v0.22.0).

The collector is disabled by default because the resctrl filesystem
must be mounted first (mount -t resctrl resctrl /sys/fs/resctrl). The
mountpoint is configurable via --collector.resctrl.path.

Counters a CPU does not support (for example mbm_local_bytes on Arm
MPAM) or that read "Unavailable" are skipped per sample. The hardware
counters wrap; Prometheus treats the wrap as a counter reset, so no
correction is applied.

Signed-off-by: René Treffer <treffer@measite.de>

Copy link
Copy Markdown
Contributor Author

I think the e2e tests for Mac OS are broken, even on the main branch, PR #3825

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL