From c01750cedbcb4d7c2ab863aa5cd662fcd811c2e3 Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Mon, 23 Sep 2024 00:56:33 +0530 Subject: [PATCH] fixup! collector/diskstats: add block device rotational Signed-off-by: Pranshu Srivastava --- collector/fixtures/e2e-64k-page-output.txt | 17 +++++++++++++++++ collector/fixtures/e2e-output.txt | 17 +++++++++++++++++ go.mod | 2 ++ go.sum | 4 ++++ 4 files changed, 40 insertions(+) diff --git a/collector/fixtures/e2e-64k-page-output.txt b/collector/fixtures/e2e-64k-page-output.txt index 605149da0e..b6b18674c2 100644 --- a/collector/fixtures/e2e-64k-page-output.txt +++ b/collector/fixtures/e2e-64k-page-output.txt @@ -622,6 +622,23 @@ node_disk_reads_merged_total{device="sdb"} 841 node_disk_reads_merged_total{device="sdc"} 141 node_disk_reads_merged_total{device="sr0"} 0 node_disk_reads_merged_total{device="vda"} 15386 +# HELP node_disk_rotational Rotational indicates whether the device is a rotational disk (1) or not (0). +# TYPE node_disk_rotational gauge +node_disk_rotational{device="dm-0"} 0 +node_disk_rotational{device="dm-1"} 0 +node_disk_rotational{device="dm-2"} 0 +node_disk_rotational{device="dm-3"} 0 +node_disk_rotational{device="dm-4"} 0 +node_disk_rotational{device="dm-5"} 0 +node_disk_rotational{device="mmcblk0"} 0 +node_disk_rotational{device="mmcblk0p1"} 0 +node_disk_rotational{device="mmcblk0p2"} 0 +node_disk_rotational{device="nvme0n1"} 0 +node_disk_rotational{device="sda"} 1 +node_disk_rotational{device="sdb"} 0 +node_disk_rotational{device="sdc"} 0 +node_disk_rotational{device="sr0"} 0 +node_disk_rotational{device="vda"} 0 # HELP node_disk_write_time_seconds_total This is the total number of seconds spent by all writes. # TYPE node_disk_write_time_seconds_total counter node_disk_write_time_seconds_total{device="dm-0"} 1.1585578e+06 diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index a80f6b6304..2fdcd0eb7a 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -644,6 +644,23 @@ node_disk_reads_merged_total{device="sdb"} 841 node_disk_reads_merged_total{device="sdc"} 141 node_disk_reads_merged_total{device="sr0"} 0 node_disk_reads_merged_total{device="vda"} 15386 +# HELP node_disk_rotational Rotational indicates whether the device is a rotational disk (1) or not (0). +# TYPE node_disk_rotational gauge +node_disk_rotational{device="dm-0"} 0 +node_disk_rotational{device="dm-1"} 0 +node_disk_rotational{device="dm-2"} 0 +node_disk_rotational{device="dm-3"} 0 +node_disk_rotational{device="dm-4"} 0 +node_disk_rotational{device="dm-5"} 0 +node_disk_rotational{device="mmcblk0"} 0 +node_disk_rotational{device="mmcblk0p1"} 0 +node_disk_rotational{device="mmcblk0p2"} 0 +node_disk_rotational{device="nvme0n1"} 0 +node_disk_rotational{device="sda"} 1 +node_disk_rotational{device="sdb"} 0 +node_disk_rotational{device="sdc"} 0 +node_disk_rotational{device="sr0"} 0 +node_disk_rotational{device="vda"} 0 # HELP node_disk_write_time_seconds_total This is the total number of seconds spent by all writes. # TYPE node_disk_write_time_seconds_total counter node_disk_write_time_seconds_total{device="dm-0"} 1.1585578e+06 diff --git a/go.mod b/go.mod index f6180440eb..1e4a98780b 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/coreos/go-systemd/v22 v22.5.0 github.com/dennwc/btrfs v0.0.0-20240418142341-0167142bde7a github.com/ema/qdisc v1.0.0 + github.com/go-kit/log v0.2.1 github.com/godbus/dbus/v5 v5.1.0 github.com/hashicorp/go-envparse v0.1.0 github.com/hodgesds/perf-utils v0.7.0 @@ -37,6 +38,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/dennwc/ioctl v1.0.0 // indirect + github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/klauspost/compress v1.17.9 // indirect diff --git a/go.sum b/go.sum index 29f642ccf3..81bdd902d5 100644 --- a/go.sum +++ b/go.sum @@ -21,6 +21,10 @@ github.com/dennwc/ioctl v1.0.0 h1:DsWAAjIxRqNcLn9x6mwfuf2pet3iB7aK90K4tF16rLg= github.com/dennwc/ioctl v1.0.0/go.mod h1:ellh2YB5ldny99SBU/VX7Nq0xiZbHphf1DrtHxxjMk0= github.com/ema/qdisc v1.0.0 h1:EHLG08FVRbWLg8uRICa3xzC9Zm0m7HyMHfXobWFnXYg= github.com/ema/qdisc v1.0.0/go.mod h1:FhIc0fLYi7f+lK5maMsesDqwYojIOh3VfRs8EVd5YJQ= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=