Skip to content

Commit ed5c66f

Browse files
committed
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 <[email protected]>
1 parent e608850 commit ed5c66f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

collector/filesystem_bsd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14-
//go:build ((openbsd && !amd64) || darwin || dragonfly) && !nofilesystem
15-
// +build openbsd,!amd64 darwin dragonfly
14+
//go:build (darwin || dragonfly) && !nofilesystem
15+
// +build darwin dragonfly
1616
// +build !nofilesystem
1717

1818
package collector

collector/filesystem_openbsd_amd64.go renamed to collector/filesystem_openbsd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ func (c *filesystemCollector) GetStats() (stats []filesystemStats, err error) {
4141

4242
stats = []filesystemStats{}
4343
for _, v := range mnt {
44-
mountpoint := string(v.F_mntonname[:])
44+
mountpoint := unix.ByteSliceToString(v.F_mntonname[:])
4545
if c.excludedMountPointsPattern.MatchString(mountpoint) {
4646
level.Debug(c.logger).Log("msg", "Ignoring mount point", "mountpoint", mountpoint)
4747
continue
4848
}
4949

50-
device := string(v.F_mntfromname[:])
51-
fstype := string(v.F_fstypename[:])
50+
device := unix.ByteSliceToString(v.F_mntfromname[:])
51+
fstype := unix.ByteSliceToString(v.F_fstypename[:])
5252
if c.excludedFSTypesPattern.MatchString(fstype) {
5353
level.Debug(c.logger).Log("msg", "Ignoring fs type", "type", fstype)
5454
continue

0 commit comments

Comments
 (0)