From ed5c66f419e9f905b0888c90fb478d4a5874ce4c Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Sun, 19 Mar 2023 12:13:11 +0100 Subject: [PATCH] Fix filesystem collector for OpenBSD to not print loads of zero bytes in name Use the filesystem collector for all OpenBSD archs, there is no reason to only use it on amd64 systems. Signed-off-by: Claudio Jeker --- collector/filesystem_bsd.go | 4 ++-- .../{filesystem_openbsd_amd64.go => filesystem_openbsd.go} | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename collector/{filesystem_openbsd_amd64.go => filesystem_openbsd.go} (92%) diff --git a/collector/filesystem_bsd.go b/collector/filesystem_bsd.go index dc35c4f8df..d3025a0171 100644 --- a/collector/filesystem_bsd.go +++ b/collector/filesystem_bsd.go @@ -11,8 +11,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build ((openbsd && !amd64) || darwin || dragonfly) && !nofilesystem -// +build openbsd,!amd64 darwin dragonfly +//go:build (darwin || dragonfly) && !nofilesystem +// +build darwin dragonfly // +build !nofilesystem package collector diff --git a/collector/filesystem_openbsd_amd64.go b/collector/filesystem_openbsd.go similarity index 92% rename from collector/filesystem_openbsd_amd64.go rename to collector/filesystem_openbsd.go index 75fc844053..16cd610dfd 100644 --- a/collector/filesystem_openbsd_amd64.go +++ b/collector/filesystem_openbsd.go @@ -41,14 +41,14 @@ func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) { stats = []filesystemStats{} for _, v := range mnt { - mountpoint := string(v.F_mntonname[:]) + mountpoint := unix.ByteSliceToString(v.F_mntonname[:]) if c.excludedMountPointsPattern.MatchString(mountpoint) { level.Debug(c.logger).Log("msg", "Ignoring mount point", "mountpoint", mountpoint) continue } - device := string(v.F_mntfromname[:]) - fstype := string(v.F_fstypename[:]) + device := unix.ByteSliceToString(v.F_mntfromname[:]) + fstype := unix.ByteSliceToString(v.F_fstypename[:]) if c.excludedFSTypesPattern.MatchString(fstype) { level.Debug(c.logger).Log("msg", "Ignoring fs type", "type", fstype) continue