Skip to content

Commit 585e397

Browse files
committed
diskstats: ignore zram devices on linux systems by default
1 parent f18cd07 commit 585e397

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

collector/diskstats_linux.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const (
3636
// See also https://www.kernel.org/doc/Documentation/block/stat.txt
3737
unixSectorSize = 512.0
3838

39-
diskstatsDefaultIgnoredDevices = "^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"
39+
diskstatsDefaultIgnoredDevices = "^(z?ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"
4040

4141
// See udevadm(8).
4242
udevDevicePropertyPrefix = "E:"

collector/diskstats_linux_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestDiskStats(t *testing.T) {
5353
*sysPath = "fixtures/sys"
5454
*procPath = "fixtures/proc"
5555
*udevDataPath = "fixtures/udev/data"
56-
*diskstatsDeviceExclude = "^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"
56+
*diskstatsDeviceExclude = "^(z?ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$"
5757
testcase := `# HELP node_disk_ata_rotation_rate_rpm ATA disk rotation rate in RPMs (0 for SSDs).
5858
# TYPE node_disk_ata_rotation_rate_rpm gauge
5959
node_disk_ata_rotation_rate_rpm{device="sda"} 7200

0 commit comments

Comments
 (0)