Closed
Conversation
Closed
Member
|
Ideally the functionality of reading and parsing should be moved to https://github.com/prometheus/procfs |
Contributor
Author
I can provide a /sys disk parser in procfs. I just need tapestats (prometheus/procfs#382 and #2044) to be merged first as I need to know if I did something wrong before starting a new parser based on it. |
diskstats now use procfs/blockdevice instead of manually reading procfs. It prefers to use /sys but it will fallback to /proc if /sys fails. Although reading /sys/block/<dev>/stat is slower, /proc/diskstats have never garanteed atomicity between lines. A new option collector.diskstats.prefer-sysfs (true by default) can be used to skip /sys. Using /sys, diskstats will ignore partitions. If they are needed, /proc must be used or procfs/blockdevice must be extended. This solves issues with ambiguous names like xvda1 that that can both represent a partition in xvda or a standalone disk (Fixes prometheus#2041). If collector.diskstats.ignored-devices was changed to include partitions, collector.diskstats.prefer-sysfs must be set to false. if collector.diskstats.ignored-devices was untouched, both /proc and /sys should return the same results. With /sys as default, collector.diskstats.ignored-devices could be simplified to match only device names, not partitions. For now, partition filtering was kept and extended to match mmcblk0p[12]. The diskstats_linux_test.go was not implemented for /sys/block. Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Contributor
Author
|
I reimplemented using procfs and opened a new PR #2072 |
Member
|
Awesome! Thank you. |
Contributor
Author
|
I reopened as #2043 as I cannot reopen after a forced-pushed |
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.
It might be slower than /proc/diskstats but it will allow to securely collect devices, not partitions. /proc/diskstats was already not atomic as, according to docs, it does not use locks and values might change on the fly.
The PR is divided in two commits. One does not change the behavior, except from reading /sys/block/*/stat instead of /proc/diskstats. It could be incorporated in a minor release without major issues.
The second one might break the user experience when collector.diskstats.ignored-devices was changed to include partitions. It could be postponed until a breakage is allowed.
diskstats_linux_test.go was removed but I can add a new one if necessary. I think that the end2end test might be enough.
fixtures/sys was expanded with the corresponding devices previously present in proc/diskstats.
Related #2041