feat(metrics): collect host Pressure Stall Information (PSI) - #388
Closed
123123213weqw wants to merge 1 commit into
Closed
feat(metrics): collect host Pressure Stall Information (PSI)#388123123213weqw wants to merge 1 commit into
123123213weqw wants to merge 1 commit into
Conversation
Add a host PSI collector reading /proc/pressure/{cpu,memory,io} that exposes some/full avg10/avg60/avg300 gauges and some/full total counters, labeled by resource (cpu|memory|io). When the kernel lacks PSI support the collector registers as inactive (types.ErrNotSupported) so it does not affect other collectors; per-resource read failures degrade gracefully.
Reuses the vendored procfs.FS.PSIStatsForResource, re-exporting PSIStats/PSILine type aliases from internal/procfs alongside the existing FS/ProcMap aliases.
Host-only MVP for ccfos#384: cgroup v2 *.pressure collection, the pressure state machine, Grafana panels and alerting are deferred.
Closes ccfos#384.
123123213weqw
force-pushed
the
feat/host-psi-metrics
branch
from
July 18, 2026 16:16
64a87c7 to
c3cda4b
Compare
Contributor
Author
|
整理我的开放 PR 队列,先关闭。分支保留,需要时重新打开或基于最新 main 重新提交。/ Cleaning up my open PR queue — closing for now. The branch is kept; will reopen or resubmit on latest main later. |
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.
What
Adds a host Pressure Stall Information (PSI) collector reading
/proc/pressure/{cpu,memory,io}and exposing some/full avg10/avg60/avg300 gauges and some/full total counters, labeled by resource.Closes #384.
Why
Memory, CPU, and I/O contention stalls are the earliest signal of resource pressure, but huatuo had no PSI collection — operators only see the fallout (OOM, request timeout, node stall) after the fact. PSI directly quantifies how long tasks were stalled by resource contention.
How
core/metrics/system_psi.gocollector (system_psi), following theloadavg/cpu_stathost-metric pattern (FlagMetric, polled viaUpdate())./proc/pressure/{cpu,memory,io}via the vendoredprocfs.FS.PSIStatsForResource(re-exportedPSIStats/PSILinetype aliases frominternal/procfs, alongside the existingFS/ProcMapaliases).psi_some_avg10/avg60/avg300,psi_full_avg10/avg60/avg300(gauges) andpsi_some_total,psi_full_total(counters), labeledresource=cpu|memory|io.cpuhas nofullline (kernel limitation), so it produces only thesomeseries./proc/pressureis absent (PSI disabled at boot) the collector returnstypes.ErrNotSupportedat registration → marked inactive, no impact on other collectors; per-resource read failures are skipped rather than failing the scrape.Changes
core/metrics/system_psi.go(new) — collector +psiSamplesmapping.core/metrics/system_psi_test.go(new) —psiSamplescases (cpu some-only, memory some+full, empty stats).internal/procfs/fs.go— re-exportPSIStats,PSILinetype aliases.Verification
Built and tested on the
wzuhost (Linux 6.8,/proc/pressurelive):go build ./...go test ./core/metrics/... ./internal/procfs/...(incl. newTestPSISamples)go vet ./core/metrics/... ./internal/procfs/...goimports/gofumpt/golangci-lint(v1.62.2) cleanmake all— all 6 binaries + BPF objects build greenOut of scope (follow-ups, per the issue)
*.pressurecollection + container association.