prometheus / procfs

procfs provides functions to retrieve system, kernel and process metrics from the pseudo-filesystem proc.
Apache License 2.0
769 stars 319 forks source link

fs: Statfs_t{} doesn't have a Type field on NetBSD, OpenBSD, or Solaris #523

Closed dcbw closed 1 year ago

dcbw commented 1 year ago

Other projects that import procfs, like node_exporter, apparently build for OSs that don't have Statfs_t.Type.

Leads to errors like (for node_exporter):

/go/bin/promu --config .promu.yml build --prefix .build/openbsd-amd64 
 >   node_exporter
# github.com/prometheus/procfs
/go/pkg/mod/github.com/prometheus/procfs@v0.9.1-0.20230517120836-7acd99d0499a/fs.go:63:14: stat.Type undefined (type syscall.Statfs_t has no field or method Type)
!! command failed: build -o .build/openbsd-amd64/node_exporter -ldflags -X github.com/prometheus/common/version.Version=1.5.0 -X github.com/prometheus/common/version.Revision=849b6076b81bf64249b4f75e0c3134d25a1da9a3 -X github.com/prometheus/common/version.Branch=pull/2669 -X github.com/prometheus/common/version.BuildUser=root@d9577d73a62f -X github.com/prometheus/common/version.BuildDate=20230517-20:49:53  -extldflags '-static' -a -tags 'netgo osusergo static_build' github.com/prometheus/node_exporter: exit status 1
dcbw commented 1 year ago

See https://app.circleci.com/pipelines/github/prometheus/node_exporter/3445/workflows/1ca8faff-eabc-45fd-a7f1-0b07dffd6569/jobs/18019 for the full node_exporter CI failure

dcbw commented 1 year ago

@SuperQ I thought about that, but given that FreeBSD/Darwin also have Type, and at least FreeBSD can emulate Linux procfs with the same magic as Linux, didn't seem quite right to make it _linux.go.