From 2f4d56397675fd2ee495c25c8d12d5f8097714c2 Mon Sep 17 00:00:00 2001 From: matt durham Date: Thu, 28 Sep 2023 09:26:34 -0400 Subject: [PATCH] Merge config changes --- collector/arp_linux.go | 6 - collector/bcache_linux.go | 4 - collector/config.go | 205 +++++++++++++++++++++++++++++++++ collector/config_bsds.go | 28 ----- collector/config_darwin.go | 26 ----- collector/config_linux.go | 43 ------- collector/config_solaris.go | 22 ---- collector/cpu_netbsd.go | 12 +- collector/diskstats_common.go | 7 -- collector/ethtool_linux.go | 6 - collector/filesystem_common.go | 16 +-- collector/hwmon_linux.go | 5 - collector/ipvs_linux.go | 4 - collector/netclass_linux.go | 7 -- collector/netdev_common.go | 12 +- collector/netstat_linux.go | 4 - collector/ntp.go | 10 -- collector/paths.go | 7 -- collector/perf_linux.go | 11 -- collector/powersupplyclass.go | 4 - collector/qdisc_linux.go | 8 -- collector/rapl_linux.go | 4 - collector/runit.go | 4 - collector/stat_linux.go | 4 - collector/supervisord.go | 4 - collector/sysctl_linux.go | 5 - collector/systemd_linux.go | 13 --- collector/tapestats_linux.go | 4 - collector/textfile.go | 4 - collector/vmstat_linux.go | 4 - collector/wifi_linux.go | 4 - 31 files changed, 215 insertions(+), 282 deletions(-) create mode 100644 collector/config.go delete mode 100644 collector/config_bsds.go delete mode 100644 collector/config_darwin.go delete mode 100644 collector/config_linux.go delete mode 100644 collector/config_solaris.go diff --git a/collector/arp_linux.go b/collector/arp_linux.go index 75059c1b..7d8e7edc 100644 --- a/collector/arp_linux.go +++ b/collector/arp_linux.go @@ -40,12 +40,6 @@ func init() { registerCollector("arp", defaultEnabled, NewARPCollector) } -type ArpConfig struct { - DeviceInclude *string - DeviceExclude *string - Netlink *bool -} - // NewARPCollector returns a new Collector exposing ARP stats. func NewARPCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { fs, err := procfs.NewFS(*config.Path.ProcPath) diff --git a/collector/bcache_linux.go b/collector/bcache_linux.go index 6773587b..bcae2686 100644 --- a/collector/bcache_linux.go +++ b/collector/bcache_linux.go @@ -36,10 +36,6 @@ type bcacheCollector struct { config *NodeCollectorConfig } -type BcacheConfig struct { - PriorityStats *bool -} - // NewBcacheCollector returns a newly allocated bcacheCollector. // It exposes a number of Linux bcache statistics. func NewBcacheCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { diff --git a/collector/config.go b/collector/config.go new file mode 100644 index 00000000..1ec2eff5 --- /dev/null +++ b/collector/config.go @@ -0,0 +1,205 @@ +// Copyright 2023 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package collector + +import "time" + +type NodeCollectorConfig struct { + Arp ArpConfig + Bcache BcacheConfig + CPU CPUConfig + DiskstatsDeviceFilter DiskstatsDeviceFilterConfig + Ethtool EthtoolConfig + Filesystem FilesystemConfig + HwMon HwMonConfig + IPVS IPVSConfig + NetClass NetClassConfig + NetDev NetDevConfig + NetStat NetStatConfig + NTP NTPConfig + Path PathConfig + Perf PerfConfig + PowerSupplyClass PowerSupplyClassConfig + Qdisc QdiscConfig + Rapl RaplConfig + Runit RunitConfig + Stat StatConfig + Supervisord SupervisordConfig + Sysctl SysctlConfig + Systemd SystemdConfig + Tapestats TapestatsConfig + TextFile TextFileConfig + VmStat VmStatConfig + Wifi WifiConfig +} + +type WifiConfig struct { + Fixtures *string +} + +type VmStatConfig struct { + Fields *string +} + +type TextFileConfig struct { + Directory *string +} +type TapestatsConfig struct { + IgnoredDevices *string +} + +type SystemdConfig struct { + UnitInclude *string + UnitIncludeSet bool + UnitExclude *string + UnitExcludeSet bool + OldUnitInclude *string + OldUnitExclude *string + Private *bool + EnableTaskMetrics *bool + EnableRestartsMetrics *bool + EnableStartTimeMetrics *bool +} + +type SysctlConfig struct { + Include *[]string + IncludeInfo *[]string +} + +type SupervisordConfig struct { + URL *string +} + +type RunitConfig struct { + ServiceDir *string +} + +type StatConfig struct { + Softirq *bool +} + +type RaplConfig struct { + ZoneLabel *bool +} + +type QdiscConfig struct { + Fixtures *string + DeviceInclude *string + OldDeviceInclude *string + DeviceExclude *string + OldDeviceExclude *string +} + +type PowerSupplyClassConfig struct { + IgnoredPowerSupplies *string +} + +type PerfConfig struct { + CPUs *string + Tracepoint *[]string + NoHwProfiler *bool + HwProfiler *[]string + NoSwProfiler *bool + SwProfiler *[]string + NoCaProfiler *bool + CaProfilerFlag *[]string +} + +type PathConfig struct { + ProcPath *string + SysPath *string + RootfsPath *string + UdevDataPath *string +} + +type NTPConfig struct { + Server *string + ServerPort *int + ProtocolVersion *int + ServerIsLocal *bool + IPTTL *int + MaxDistance *time.Duration + OffsetTolerance *time.Duration +} + +type NetStatConfig struct { + Fields *string +} + +type NetDevConfig struct { + DeviceInclude *string + OldDeviceInclude *string + DeviceExclude *string + OldDeviceExclude *string + AddressInfo *bool + DetailedMetrics *bool + Netlink *bool +} + +type NetClassConfig struct { + IgnoredDevices *string + InvalidSpeed *bool + Netlink *bool + RTNLWithStats *bool +} + +type ArpConfig struct { + DeviceInclude *string + DeviceExclude *string + Netlink *bool +} + +type BcacheConfig struct { + PriorityStats *bool +} + +type CPUConfig struct { + EnableCPUGuest *bool + EnableCPUInfo *bool + FlagsInclude *string + BugsInclude *string +} + +type DiskstatsDeviceFilterConfig struct { + DeviceExclude *string + DeviceExcludeSet bool + OldDeviceExclude *string + DeviceInclude *string +} + +type EthtoolConfig struct { + DeviceInclude *string + DeviceExclude *string + IncludedMetrics *string +} + +type HwMonConfig struct { + ChipInclude *string + ChipExclude *string +} + +type FilesystemConfig struct { + MountPointsExclude *string + MountPointsExcludeSet bool + OldMountPointsExcluded *string + FSTypesExclude *string + FSTypesExcludeSet bool + OldFSTypesExcluded *string + MountTimeout *time.Duration + StatWorkerCount *int +} + +type IPVSConfig struct { + Labels *string +} diff --git a/collector/config_bsds.go b/collector/config_bsds.go deleted file mode 100644 index 5d11748c..00000000 --- a/collector/config_bsds.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2023 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build dragonfly || freebsd || netbsd || openbsd || 386 -// +build dragonfly freebsd netbsd openbsd 386 - -package collector - -type NodeCollectorConfig struct { - DiskstatsDeviceFilter DiskstatsDeviceFilterConfig - Filesystem FilesystemConfig - NetDev NetDevConfig - NTP NTPConfig - Path PathConfig - Runit RunitConfig - Supervisord SupervisordConfig - TextFile TextFileConfig -} diff --git a/collector/config_darwin.go b/collector/config_darwin.go deleted file mode 100644 index 5470b331..00000000 --- a/collector/config_darwin.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2023 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package collector - -type NodeCollectorConfig struct { - DiskstatsDeviceFilter DiskstatsDeviceFilterConfig - Filesystem FilesystemConfig - NetDev NetDevConfig - NTP NTPConfig - Path PathConfig - PowerSupplyClass PowerSupplyClassConfig - Runit RunitConfig - Supervisord SupervisordConfig - TextFile TextFileConfig -} diff --git a/collector/config_linux.go b/collector/config_linux.go deleted file mode 100644 index 324a06ff..00000000 --- a/collector/config_linux.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2023 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package collector - -type NodeCollectorConfig struct { - Arp ArpConfig - Bcache BcacheConfig - CPU CPUConfig - DiskstatsDeviceFilter DiskstatsDeviceFilterConfig - Ethtool EthtoolConfig - Filesystem FilesystemConfig - HwMon HwMonConfig - IPVS IPVSConfig - NetClass NetClassConfig - NetDev NetDevConfig - NetStat NetStatConfig - NTP NTPConfig - Path PathConfig - Perf PerfConfig - PowerSupplyClass PowerSupplyClassConfig - Qdisc QdiscConfig - Rapl RaplConfig - Runit RunitConfig - Stat StatConfig - Supervisord SupervisordConfig - Sysctl SysctlConfig - Systemd SystemdConfig - Tapestats TapestatsConfig - TextFile TextFileConfig - VmStat VmStatConfig - Wifi WifiConfig -} diff --git a/collector/config_solaris.go b/collector/config_solaris.go deleted file mode 100644 index c79f4599..00000000 --- a/collector/config_solaris.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 The Prometheus Authors -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package collector - -type NodeCollectorConfig struct { - NTP NTPConfig - Path PathConfig - Runit RunitConfig - Supervisord SupervisordConfig - TextFile TextFileConfig -} diff --git a/collector/cpu_netbsd.go b/collector/cpu_netbsd.go index 776b4549..4bf1aaf2 100644 --- a/collector/cpu_netbsd.go +++ b/collector/cpu_netbsd.go @@ -92,8 +92,8 @@ func ioctl(fd int, nr int64, typ byte, size uintptr, retptr unsafe.Pointer) erro return nil } -func readSysmonProperties() (sysmonProperties, error) { - fd, err := unix.Open(rootfsFilePath("/dev/sysmon"), unix.O_RDONLY, 0777) +func readSysmonProperties(p PathConfig) (sysmonProperties, error) { + fd, err := unix.Open(p.rootfsStripPrefix("/dev/sysmon"), unix.O_RDONLY, 0777) if err != nil { return nil, err } @@ -142,12 +142,12 @@ func convertTemperatures(prop sysmonProperty, res map[int]float64) error { return nil } -func getCPUTemperatures() (map[int]float64, error) { +func getCPUTemperatures(p PathConfig) (map[int]float64, error) { res := make(map[int]float64) // Read all properties - props, err := readSysmonProperties() + props, err := readSysmonProperties(p) if err != nil { return res, err } @@ -215,6 +215,7 @@ type statCollector struct { cpu typedDesc temp typedDesc logger log.Logger + p PathConfig } func init() { @@ -231,6 +232,7 @@ func NewStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector []string{"cpu"}, nil, ), prometheus.GaugeValue}, logger: logger, + p: config.Path, }, nil } @@ -253,7 +255,7 @@ func (c *statCollector) Update(ch chan<- prometheus.Metric) error { return err } - cpuTemperatures, err := getCPUTemperatures() + cpuTemperatures, err := getCPUTemperatures(c.p) if err != nil { return err } diff --git a/collector/diskstats_common.go b/collector/diskstats_common.go index 0b927e86..e636aa68 100644 --- a/collector/diskstats_common.go +++ b/collector/diskstats_common.go @@ -77,13 +77,6 @@ var ( ) ) -type DiskstatsDeviceFilterConfig struct { - DeviceExclude *string - DeviceExcludeSet bool - OldDeviceExclude *string - DeviceInclude *string -} - func newDiskstatsDeviceFilter(config DiskstatsDeviceFilterConfig, logger log.Logger) (deviceFilter, error) { if *config.OldDeviceExclude != "" { if !config.DeviceExcludeSet { diff --git a/collector/ethtool_linux.go b/collector/ethtool_linux.go index 860445bf..6bfc869c 100644 --- a/collector/ethtool_linux.go +++ b/collector/ethtool_linux.go @@ -78,12 +78,6 @@ type ethtoolCollector struct { logger log.Logger } -type EthtoolConfig struct { - DeviceInclude *string - DeviceExclude *string - IncludedMetrics *string -} - // makeEthtoolCollector is the internal constructor for EthtoolCollector. // This allows NewEthtoolTestCollector to override its .ethtool interface // for testing. diff --git a/collector/filesystem_common.go b/collector/filesystem_common.go index 6e0deddc..aca57da7 100644 --- a/collector/filesystem_common.go +++ b/collector/filesystem_common.go @@ -19,12 +19,10 @@ package collector import ( "errors" - "regexp" - "time" - "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" + "regexp" ) // Arch-dependent implementation must define: @@ -57,16 +55,6 @@ type filesystemStats struct { files, filesFree float64 ro, deviceError float64 } -type FilesystemConfig struct { - MountPointsExclude *string - MountPointsExcludeSet bool - OldMountPointsExcluded *string - FSTypesExclude *string - FSTypesExcludeSet bool - OldFSTypesExcluded *string - MountTimeout *time.Duration - StatWorkerCount *int -} func init() { registerCollector("filesystem", defaultEnabled, NewFilesystemCollector) @@ -165,7 +153,7 @@ func NewFilesystemCollector(config *NodeCollectorConfig, logger log.Logger) (Col } func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) error { - stats, err := c.GetStats(c.config.Path) + stats, err := c.GetStats() if err != nil { return err } diff --git a/collector/hwmon_linux.go b/collector/hwmon_linux.go index 7ce6e904..40fd5599 100644 --- a/collector/hwmon_linux.go +++ b/collector/hwmon_linux.go @@ -52,11 +52,6 @@ type hwMonCollector struct { config *NodeCollectorConfig } -type HwMonConfig struct { - ChipInclude *string - ChipExclude *string -} - // NewHwMonCollector returns a new Collector exposing /sys/class/hwmon stats // (similar to lm-sensors). func NewHwMonCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { diff --git a/collector/ipvs_linux.go b/collector/ipvs_linux.go index 266e9f80..487a25dc 100644 --- a/collector/ipvs_linux.go +++ b/collector/ipvs_linux.go @@ -69,10 +69,6 @@ func init() { registerCollector("ipvs", defaultEnabled, NewIPVSCollector) } -type IPVSConfig struct { - Labels *string -} - // NewIPVSCollector sets up a new collector for IPVS metrics. It accepts the // "procfs" config parameter to override the default proc location (/proc). func NewIPVSCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { diff --git a/collector/netclass_linux.go b/collector/netclass_linux.go index 38a6dd4d..0cacb9fb 100644 --- a/collector/netclass_linux.go +++ b/collector/netclass_linux.go @@ -42,13 +42,6 @@ func init() { registerCollector("netclass", defaultEnabled, NewNetClassCollector) } -type NetClassConfig struct { - IgnoredDevices *string - InvalidSpeed *bool - Netlink *bool - RTNLWithStats *bool -} - // NewNetClassCollector returns a new Collector exposing network class stats. func NewNetClassCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { fs, err := sysfs.NewFS(*config.Path.SysPath) diff --git a/collector/netdev_common.go b/collector/netdev_common.go index 33ef2023..b841378e 100644 --- a/collector/netdev_common.go +++ b/collector/netdev_common.go @@ -44,16 +44,6 @@ func init() { registerCollector("netdev", defaultEnabled, NewNetDevCollector) } -type NetDevConfig struct { - DeviceInclude *string - OldDeviceInclude *string - DeviceExclude *string - OldDeviceExclude *string - AddressInfo *bool - DetailedMetrics *bool - Netlink *bool -} - // NewNetDevCollector returns a new Collector exposing network device stats. func NewNetDevCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { if *config.NetDev.OldDeviceInclude != "" { @@ -112,7 +102,7 @@ func (c *netDevCollector) metricDesc(key string) *prometheus.Desc { } func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error { - netDev, err := getNetDevStats(&c.deviceFilter, c.logger) + netDev, err := getNetDevStats(c.config, c.config.NetDev.Netlink, &c.deviceFilter, c.logger) if err != nil { return fmt.Errorf("couldn't get netstats: %w", err) } diff --git a/collector/netstat_linux.go b/collector/netstat_linux.go index a99d023e..b3f21dbc 100644 --- a/collector/netstat_linux.go +++ b/collector/netstat_linux.go @@ -44,10 +44,6 @@ func init() { registerCollector(netStatsSubsystem, defaultEnabled, NewNetStatCollector) } -type NetStatConfig struct { - Fields *string -} - // NewNetStatCollector takes and returns // a new Collector exposing network stats. func NewNetStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { diff --git a/collector/ntp.go b/collector/ntp.go index 6a813380..0652e32b 100644 --- a/collector/ntp.go +++ b/collector/ntp.go @@ -48,16 +48,6 @@ func init() { registerCollector("ntp", defaultDisabled, NewNtpCollector) } -type NTPConfig struct { - Server *string - ServerPort *int - ProtocolVersion *int - ServerIsLocal *bool - IPTTL *int - MaxDistance *time.Duration - OffsetTolerance *time.Duration -} - // NewNtpCollector returns a new Collector exposing sanity of local NTP server. // Default definition of "local" is: // - collector.ntp.server address is a loopback address (or collector.ntp.server-is-mine flag is turned on) diff --git a/collector/paths.go b/collector/paths.go index e14e0204..6a2c6655 100644 --- a/collector/paths.go +++ b/collector/paths.go @@ -18,13 +18,6 @@ import ( "strings" ) -type PathConfig struct { - ProcPath *string - SysPath *string - RootfsPath *string - UdevDataPath *string -} - func (p *PathConfig) procFilePath(name string) string { return filepath.Join(*p.ProcPath, name) } diff --git a/collector/perf_linux.go b/collector/perf_linux.go index 148c3322..bedc5a43 100644 --- a/collector/perf_linux.go +++ b/collector/perf_linux.go @@ -37,17 +37,6 @@ func init() { registerCollector(perfSubsystem, defaultDisabled, NewPerfCollector) } -type PerfConfig struct { - CPUs *string - Tracepoint *[]string - NoHwProfiler *bool - HwProfiler *[]string - NoSwProfiler *bool - SwProfiler *[]string - NoCaProfiler *bool - CaProfilerFlag *[]string -} - var ( perfHardwareProfilerMap = map[string]perf.HardwareProfilerType{ "CpuCycles": perf.CpuCyclesProfiler, diff --git a/collector/powersupplyclass.go b/collector/powersupplyclass.go index b869f6ca..89b38751 100644 --- a/collector/powersupplyclass.go +++ b/collector/powersupplyclass.go @@ -36,10 +36,6 @@ func init() { registerCollector("powersupplyclass", defaultEnabled, NewPowerSupplyClassCollector) } -type PowerSupplyClassConfig struct { - IgnoredPowerSupplies *string -} - func NewPowerSupplyClassCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { pattern := regexp.MustCompile(*config.PowerSupplyClass.IgnoredPowerSupplies) return &powerSupplyClassCollector{ diff --git a/collector/qdisc_linux.go b/collector/qdisc_linux.go index 422520b8..fb5217ec 100644 --- a/collector/qdisc_linux.go +++ b/collector/qdisc_linux.go @@ -45,14 +45,6 @@ func init() { registerCollector("qdisc", defaultDisabled, NewQdiscStatCollector) } -type QdiscConfig struct { - Fixtures *string - DeviceInclude *string - OldDeviceInclude *string - DeviceExclude *string - OldDeviceExclude *string -} - // NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics. func NewQdiscStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { if *config.Qdisc.OldDeviceInclude != "" { diff --git a/collector/rapl_linux.go b/collector/rapl_linux.go index 0ec9c4db..94a0ba05 100644 --- a/collector/rapl_linux.go +++ b/collector/rapl_linux.go @@ -42,10 +42,6 @@ func init() { registerCollector(raplCollectorSubsystem, defaultEnabled, NewRaplCollector) } -type RaplConfig struct { - ZoneLabel *bool -} - // NewRaplCollector returns a new Collector exposing RAPL metrics. func NewRaplCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { fs, err := sysfs.NewFS(*config.Path.SysPath) diff --git a/collector/runit.go b/collector/runit.go index cbacdaa5..73b40654 100644 --- a/collector/runit.go +++ b/collector/runit.go @@ -36,10 +36,6 @@ func init() { registerCollector("runit", defaultDisabled, NewRunitCollector) } -type RunitConfig struct { - ServiceDir *string -} - // NewRunitCollector returns a new Collector exposing runit statistics. func NewRunitCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { var ( diff --git a/collector/stat_linux.go b/collector/stat_linux.go index f549306f..01393387 100644 --- a/collector/stat_linux.go +++ b/collector/stat_linux.go @@ -41,10 +41,6 @@ func init() { registerCollector("stat", defaultEnabled, NewStatCollector) } -type StatConfig struct { - Softirq *bool -} - // NewStatCollector returns a new Collector exposing kernel/system statistics. func NewStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { fs, err := procfs.NewFS(*config.Path.ProcPath) diff --git a/collector/supervisord.go b/collector/supervisord.go index c70ed060..57ac5b8f 100644 --- a/collector/supervisord.go +++ b/collector/supervisord.go @@ -46,10 +46,6 @@ func init() { registerCollector("supervisord", defaultDisabled, NewSupervisordCollector) } -type SupervisordConfig struct { - URL *string -} - // NewSupervisordCollector returns a new Collector exposing supervisord statistics. func NewSupervisordCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { var ( diff --git a/collector/sysctl_linux.go b/collector/sysctl_linux.go index a98d82af..63c1307d 100644 --- a/collector/sysctl_linux.go +++ b/collector/sysctl_linux.go @@ -37,11 +37,6 @@ func init() { registerCollector("sysctl", defaultDisabled, NewSysctlCollector) } -type SysctlConfig struct { - Include *[]string - IncludeInfo *[]string -} - func NewSysctlCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { fs, err := procfs.NewFS(*config.Path.ProcPath) if err != nil { diff --git a/collector/systemd_linux.go b/collector/systemd_linux.go index 2aa46716..869fc6f3 100644 --- a/collector/systemd_linux.go +++ b/collector/systemd_linux.go @@ -70,19 +70,6 @@ func init() { registerCollector("systemd", defaultDisabled, NewSystemdCollector) } -type SystemdConfig struct { - UnitInclude *string - UnitIncludeSet bool - UnitExclude *string - UnitExcludeSet bool - OldUnitInclude *string - OldUnitExclude *string - Private *bool - EnableTaskMetrics *bool - EnableRestartsMetrics *bool - EnableStartTimeMetrics *bool -} - // NewSystemdCollector returns a new Collector exposing systemd statistics. func NewSystemdCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { const subsystem = "systemd" diff --git a/collector/tapestats_linux.go b/collector/tapestats_linux.go index 38a326f3..d7088d84 100644 --- a/collector/tapestats_linux.go +++ b/collector/tapestats_linux.go @@ -47,10 +47,6 @@ func init() { registerCollector("tapestats", defaultEnabled, NewTapestatsCollector) } -type TapestatsConfig struct { - IgnoredDevices *string -} - // NewTapestatsCollector returns a new Collector exposing tape device stats. // Docs from https://www.kernel.org/doc/html/latest/scsi/st.html#sysfs-and-statistics-for-tape-devices func NewTapestatsCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { diff --git a/collector/textfile.go b/collector/textfile.go index 5e5db0aa..f60fff87 100644 --- a/collector/textfile.go +++ b/collector/textfile.go @@ -51,10 +51,6 @@ func init() { registerCollector("textfile", defaultEnabled, NewTextFileCollector) } -type TextFileConfig struct { - Directory *string -} - // NewTextFileCollector returns a new Collector exposing metrics read from files // in the given textfile directory. func NewTextFileCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { diff --git a/collector/vmstat_linux.go b/collector/vmstat_linux.go index bd285a2e..134362ce 100644 --- a/collector/vmstat_linux.go +++ b/collector/vmstat_linux.go @@ -42,10 +42,6 @@ func init() { registerCollector(vmStatSubsystem, defaultEnabled, NewvmStatCollector) } -type VmStatConfig struct { - Fields *string -} - // NewvmStatCollector returns a new Collector exposing vmstat stats. func NewvmStatCollector(config *NodeCollectorConfig, logger log.Logger) (Collector, error) { pattern := regexp.MustCompile(*config.VmStat.Fields) diff --git a/collector/wifi_linux.go b/collector/wifi_linux.go index 4f27b6fc..85cdab17 100644 --- a/collector/wifi_linux.go +++ b/collector/wifi_linux.go @@ -52,10 +52,6 @@ func init() { registerCollector("wifi", defaultDisabled, NewWifiCollector) } -type WifiConfig struct { - Fixtures *string -} - var _ wifiStater = &wifi.Client{} // wifiStater is an interface used to swap out a *wifi.Client for end to end tests.