From 8ea822f67a257257462553d36c479920bf588c26 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Sun, 12 May 2024 18:25:06 +0200 Subject: [PATCH] zfs: move common init function out of arch-specific files Signed-off-by: Daniel Swarbrick --- collector/zfs.go | 4 ++++ collector/zfs_freebsd.go | 4 ---- collector/zfs_linux.go | 4 ---- collector/zfs_solaris.go | 4 ---- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/collector/zfs.go b/collector/zfs.go index 67e7ca61..11b46fae 100644 --- a/collector/zfs.go +++ b/collector/zfs.go @@ -15,3 +15,7 @@ // +build !nozfs package collector + +func init() { + registerCollector("zfs", defaultEnabled, NewZFSCollector) +} diff --git a/collector/zfs_freebsd.go b/collector/zfs_freebsd.go index 65495781..76404766 100644 --- a/collector/zfs_freebsd.go +++ b/collector/zfs_freebsd.go @@ -30,10 +30,6 @@ const ( zfsCollectorSubsystem = "zfs" ) -func init() { - registerCollector("zfs", defaultEnabled, NewZfsCollector) -} - func NewZfsCollector(logger *slog.Logger) (Collector, error) { return &zfsCollector{ sysctls: []bsdSysctl{ diff --git a/collector/zfs_linux.go b/collector/zfs_linux.go index e4bbe7c3..c1ce284b 100644 --- a/collector/zfs_linux.go +++ b/collector/zfs_linux.go @@ -58,10 +58,6 @@ type zfsCollector struct { logger *slog.Logger } -func init() { - registerCollector("zfs", defaultEnabled, NewZFSCollector) -} - // NewZFSCollector returns a new Collector exposing ZFS statistics. func NewZFSCollector(logger *slog.Logger) (Collector, error) { return &zfsCollector{ diff --git a/collector/zfs_solaris.go b/collector/zfs_solaris.go index 4ff8ceb2..7229526c 100644 --- a/collector/zfs_solaris.go +++ b/collector/zfs_solaris.go @@ -61,10 +61,6 @@ const ( zfsCollectorSubsystem = "zfs" ) -func init() { - registerCollector("zfs", defaultEnabled, NewZfsCollector) -} - func NewZfsCollector(logger *slog.Logger) (Collector, error) { return &zfsCollector{ abdstatsLinearCount: prometheus.NewDesc(