Fix btrfs device stats always being zero (#2516)

* Respect rootfs path config option in btrfs ioctl
* Fix btrfs device stats always being zero

Signed-off-by: Marcus Cobden <leth@users.noreply.github.com>
pull/2524/head
Marcus Cobden 2 years ago committed by GitHub
parent fd14fb04c7
commit 936368d217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -123,13 +123,15 @@ func (c *btrfsCollector) getIoctlStats() (map[string]*btrfsIoctlFsStats, error)
continue
}
fs, err := dennwc.Open(mount.mountPoint, true)
mountPath := rootfsFilePath(mount.mountPoint)
fs, err := dennwc.Open(mountPath, true)
if err != nil {
// Failed to open this mount point, maybe we didn't have permission
// maybe we'll find another mount point for this FS later.
level.Debug(c.logger).Log(
"msg", "Error inspecting btrfs mountpoint",
"mountPoint", mount.mountPoint,
"mountPoint", mountPath,
"err", err)
continue
}
@ -140,7 +142,7 @@ func (c *btrfsCollector) getIoctlStats() (map[string]*btrfsIoctlFsStats, error)
// perhaps it'll work with a different mount point
level.Debug(c.logger).Log(
"msg", "Error querying btrfs filesystem",
"mountPoint", mount.mountPoint,
"mountPoint", mountPath,
"err", err)
continue
}
@ -155,7 +157,7 @@ func (c *btrfsCollector) getIoctlStats() (map[string]*btrfsIoctlFsStats, error)
if err != nil {
level.Debug(c.logger).Log(
"msg", "Error querying btrfs device stats",
"mountPoint", mount.mountPoint,
"mountPoint", mountPath,
"err", err)
continue
}

@ -5,7 +5,7 @@ go 1.17
require (
github.com/beevik/ntp v0.3.0
github.com/coreos/go-systemd/v22 v22.4.0
github.com/dennwc/btrfs v0.0.0-20220403080356-b3db0b2dedac
github.com/dennwc/btrfs v0.0.0-20221026161108-3097362dc072
github.com/ema/qdisc v0.0.0-20200603082823-62d0308e3e00
github.com/go-kit/log v0.2.1
github.com/godbus/dbus/v5 v5.1.0

@ -99,8 +99,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dennwc/btrfs v0.0.0-20220403080356-b3db0b2dedac h1:cjfIEKdg/lZ+ewJk8FYoYZTN2HY/okVSPtmHLaYMAvE=
github.com/dennwc/btrfs v0.0.0-20220403080356-b3db0b2dedac/go.mod h1:MYsOV9Dgsec3FFSOjywi0QK5r6TeBbdWxdrMGtiYXHA=
github.com/dennwc/btrfs v0.0.0-20221026161108-3097362dc072 h1:7jWBDCngQSBfRmrRCpYH3iPPVOe5i8xbl+5rQHkwZDE=
github.com/dennwc/btrfs v0.0.0-20221026161108-3097362dc072/go.mod h1:MYsOV9Dgsec3FFSOjywi0QK5r6TeBbdWxdrMGtiYXHA=
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 v0.0.0-20200603082823-62d0308e3e00 h1:0GHzegkDz/zSrt+Zph1OueNImPdUxoToypnkhhRYTjI=

Loading…
Cancel
Save