Skip to content

Conversation

@stevenjm
Copy link
Contributor

This code (both implementation and tests) is largely based on the existing mountinfo implementation.

Implementation of #244.

This code (both implementation and tests) is largely based on the
existing mountinfo implementation.

Signed-off-by: Steven McDonald <steven.mcdonald@usabilla.com>
Copy link
Contributor

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a code perspective this seems pretty good.

I'd like to see the tests make use of subtests and go-cmp, and I'd also like to see some tests with a fixture copied from /proc/swaps on your own system.

You can see what I did for tests in https://github.com/prometheus/procfs/blob/master/net_sockstat_test.go.

You can add fixtures by following https://github.com/prometheus/procfs#updating-test-fixtures.

@stevenjm
Copy link
Contributor Author

@mdlayher Does this look reasonable to you?

Signed-off-by: Steven McDonald <steven.mcdonald@usabilla.com>
Copy link
Collaborator

@pgier pgier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pgier pgier merged commit 8a40bcd into prometheus:master Jan 21, 2020
@pgier pgier mentioned this pull request Jan 23, 2020
fabiand added a commit to fabiand/node_exporter that referenced this pull request Sep 24, 2025
Building on prometheus/procfs#246 this PR is introducing metrics around swap devices.

Today metrics around swap are already available, but they are on the node level.
With this PR, metrics are now available per device.

Relates to: prometheus#1890

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
fabiand added a commit to fabiand/node_exporter that referenced this pull request Sep 24, 2025
Building on prometheus/procfs#246 this PR is introducing metrics around swap devices.

Today metrics around swap are already available, but they are on the node level.
With this PR, metrics are now available per device.

Relates to: prometheus#1890

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
Co-authored-by: claude.ai
SuperQ pushed a commit to prometheus/node_exporter that referenced this pull request Oct 6, 2025
* Add /proc/swaps collector

Building on prometheus/procfs#246 this PR is introducing metrics around swap devices.

Today metrics around swap are already available, but they are on the node level.
With this PR, metrics are now available per device.

Relates to: #1890

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
Co-authored-by: claude.ai


---------

Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
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.

4 participants