Skip to content

zfs_freebsd: Was PR #2753 incomplete? #2896

@phyber

Description

@phyber

Host operating system: output of uname -a

FreeBSD hostname.local 13.2-RELEASE-p8 FreeBSD 13.2-RELEASE-p8 GENERIC amd64

node_exporter version: output of node_exporter --version

Building from current master d8e2be1e88b3d663a5852f04efd695461e722be4

Are you running node_exporter in Docker?

No

What did you do that produced an error?

Attempt to compile it

What did you expect to see?

Output of a nice node_exporter binary

What did you see instead?

# github.com/prometheus/node_exporter/collector
collector/exec_bsd.go:65:4: undefined: labels
collector/exec_bsd.go:65:12: cannot use nil as bsdSysctl value in array or slice literal
collector/zfs_freebsd.go:337:6: undefined: strings
collector/zfs_freebsd.go:338:46: undefined: strings
collector/zfs_freebsd.go:342:28: undefined: zfsDatasetsNames
collector/zfs_freebsd.go:345:15: undefined: strings
collector/zfs_freebsd.go:349:22: undefined: fmt.SprintF
collector/zfs_freebsd.go:350:22: undefined: fmt.SprintF
collector/zfs_freebsd.go:351:60: undefined: poolObj

The labels issue was an easy fix, and I've submitted PR #2895 for that.

The zfs_freebsd.go stuff is more complicated. It looks like the author of #2753 may have submitted incomplete and untested/uncompiled code. For example:

  • The strings library wasn't imported
  • fmt.SprintF doesn't exist, it's fmt.Sprintf
  • zfsDatasetsNames doesn't exist, it's zfsDatasetNames
  • A poolObj variable appears from nowhere (isn't defined)

Most of these appear to be easily fixable, but I have no idea where poolObj should be coming from.

Resolving the easy issues from above results in further errors:

collector/zfs_freebsd.go:338:24: cannot use dataset (variable of type int) as string value in argument to strings.HasSuffix
collector/zfs_freebsd.go:339:65: cannot use dataset (variable of type int) as string value in argument to strings.SplitAfter
collector/zfs_freebsd.go:345:15: cannot use zpoolDataset (variable of type int) as string value in map literal
collector/zfs_freebsd.go:346:34: cannot use zpoolDataset (variable of type int) as string value in argument to strings.SplitAfter
collector/zfs_freebsd.go:352:60: undefined: poolObj

I don't know if the whole #2753 should be backed out or not. There's a lot of breakage here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions