Skip to content

nfsd: ignore unknown metric lines instead of failing#851

Open
locker95 wants to merge 1 commit into
prometheus:masterfrom
locker95:fix/nfsd-skip-unknown-metrics
Open

nfsd: ignore unknown metric lines instead of failing#851
locker95 wants to merge 1 commit into
prometheus:masterfrom
locker95:fix/nfsd-skip-unknown-metrics

Conversation

@locker95

Copy link
Copy Markdown

What

ParseServerRPCStats currently returns an error when /proc/net/rpc/nfsd contains a metric key it does not know about. That fails the whole parse, so callers such as node_exporter export no NFSd metrics for a single new kernel field.

Skip unknown keys and keep returning the stats we already understand. Known keys (including wdeleg_getattr) are unchanged.

Why

Linux 6.6+ added wdeleg_getattr (handled in #574). The same failure mode will hit again the next time the kernel adds a line. Other parsers in this repo already ignore unknown prefixes for forward compatibility (e.g. PSI).

Related discussion: prometheus/node_exporter#2799

Test

go test ./nfs/ -count=1 -run TestNewNFSdServerRPCStats

Adds a fixture case with a synthetic future_kernel_stat line alongside known metrics.

New kernel versions can add lines to /proc/net/rpc/nfsd (for example
wdeleg_getattr on Linux 6.6+). Treating an unknown key as a hard error
makes ParseServerRPCStats return nothing, so consumers such as
node_exporter drop all NFSd metrics for one new field.

Skip unknown keys and keep returning the metrics we already understand.
Known keys (including wdeleg_getattr) are still parsed as before.

Related to prometheus/node_exporter#2799

Signed-off-by: Dean Chen <862469039@qq.com>
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.

1 participant