Skip to content

Commit 1087cea

Browse files
committed
Apply v2.0.0 deprecations
* Remove deprecated collectors. * Remove deprecated flags. * Flip rapl label feature flag to true. Signed-off-by: Ben Kochie <[email protected]>
1 parent acdd9b8 commit 1087cea

13 files changed

+20
-600
lines changed

collector/diskstats_common.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,10 @@ const (
3232
var (
3333
diskLabelNames = []string{"device"}
3434

35-
diskstatsDeviceExcludeSet bool
36-
diskstatsDeviceExclude = kingpin.Flag(
35+
diskstatsDeviceExclude = kingpin.Flag(
3736
"collector.diskstats.device-exclude",
3837
"Regexp of diskstats devices to exclude (mutually exclusive to device-include).",
39-
).Default(diskstatsDefaultIgnoredDevices).PreAction(func(c *kingpin.ParseContext) error {
40-
diskstatsDeviceExcludeSet = true
41-
return nil
42-
}).String()
43-
oldDiskstatsDeviceExclude = kingpin.Flag(
44-
"collector.diskstats.ignored-devices",
45-
"DEPRECATED: Use collector.diskstats.device-exclude",
46-
).Hidden().String()
38+
).Default(diskstatsDefaultIgnoredDevices).String()
4739

4840
diskstatsDeviceInclude = kingpin.Flag("collector.diskstats.device-include", "Regexp of diskstats devices to include (mutually exclusive to device-exclude).").String()
4941

@@ -93,15 +85,6 @@ var (
9385
)
9486

9587
func newDiskstatsDeviceFilter(logger *slog.Logger) (deviceFilter, error) {
96-
if *oldDiskstatsDeviceExclude != "" {
97-
if !diskstatsDeviceExcludeSet {
98-
logger.Warn("--collector.diskstats.ignored-devices is DEPRECATED and will be removed in 2.0.0, use --collector.diskstats.device-exclude")
99-
*diskstatsDeviceExclude = *oldDiskstatsDeviceExclude
100-
} else {
101-
return deviceFilter{}, errors.New("--collector.diskstats.ignored-devices and --collector.diskstats.device-exclude are mutually exclusive")
102-
}
103-
}
104-
10588
if *diskstatsDeviceExclude != "" && *diskstatsDeviceInclude != "" {
10689
return deviceFilter{}, errors.New("device-exclude & device-include are mutually exclusive")
10790
}

collector/filesystem_common.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ var (
4141
mountPointsExcludeSet = true
4242
return nil
4343
}).String()
44-
oldMountPointsExcluded = kingpin.Flag(
45-
"collector.filesystem.ignored-mount-points",
46-
"Regexp of mount points to ignore for filesystem collector.",
47-
).Hidden().String()
4844
mountPointsInclude = kingpin.Flag(
4945
"collector.filesystem.mount-points-include",
5046
"Regexp of mount points to include for filesystem collector. (mutually exclusive to mount-points-exclude)",
@@ -58,10 +54,6 @@ var (
5854
fsTypesExcludeSet = true
5955
return nil
6056
}).String()
61-
oldFSTypesExcluded = kingpin.Flag(
62-
"collector.filesystem.ignored-fs-types",
63-
"Regexp of filesystem types to ignore for filesystem collector.",
64-
).Hidden().String()
6557
fsTypesInclude = kingpin.Flag(
6658
"collector.filesystem.fs-types-include",
6759
"Regexp of filesystem types to exclude for filesystem collector. (mutually exclusive to fs-types-exclude)",
@@ -228,15 +220,6 @@ func (c *filesystemCollector) Update(ch chan<- prometheus.Metric) error {
228220
}
229221

230222
func newMountPointsFilter(logger *slog.Logger) (deviceFilter, error) {
231-
if *oldMountPointsExcluded != "" {
232-
if !mountPointsExcludeSet {
233-
logger.Warn("--collector.filesystem.ignored-mount-points is DEPRECATED and will be removed in 2.0.0, use --collector.filesystem.mount-points-exclude")
234-
*mountPointsExclude = *oldMountPointsExcluded
235-
} else {
236-
return deviceFilter{}, errors.New("--collector.filesystem.ignored-mount-points and --collector.filesystem.mount-points-exclude are mutually exclusive")
237-
}
238-
}
239-
240223
if *mountPointsInclude != "" && !mountPointsExcludeSet {
241224
logger.Debug("mount-points-exclude flag not set when mount-points-include flag is set, assuming include is desired")
242225
*mountPointsExclude = ""
@@ -257,15 +240,6 @@ func newMountPointsFilter(logger *slog.Logger) (deviceFilter, error) {
257240
}
258241

259242
func newFSTypeFilter(logger *slog.Logger) (deviceFilter, error) {
260-
if *oldFSTypesExcluded != "" {
261-
if !fsTypesExcludeSet {
262-
logger.Warn("--collector.filesystem.ignored-fs-types is DEPRECATED and will be removed in 2.0.0, use --collector.filesystem.fs-types-exclude")
263-
*fsTypesExclude = *oldFSTypesExcluded
264-
} else {
265-
return deviceFilter{}, errors.New("--collector.filesystem.ignored-fs-types and --collector.filesystem.fs-types-exclude are mutually exclusive")
266-
}
267-
}
268-
269243
if *fsTypesInclude != "" && !fsTypesExcludeSet {
270244
logger.Debug("fs-types-exclude flag not set when fs-types-include flag is set, assuming include is desired")
271245
*fsTypesExclude = ""

collector/fixtures/e2e-64k-page-output.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,12 +2918,10 @@ node_qdisc_packets_total{device="wlan0",kind="fq"} 42
29182918
# TYPE node_qdisc_requeues_total counter
29192919
node_qdisc_requeues_total{device="eth0",kind="pfifo_fast"} 2
29202920
node_qdisc_requeues_total{device="wlan0",kind="fq"} 1
2921-
# HELP node_rapl_core_joules_total Current RAPL core value in joules
2922-
# TYPE node_rapl_core_joules_total counter
2923-
node_rapl_core_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0:0"} 118821.284256
2924-
# HELP node_rapl_package_joules_total Current RAPL package value in joules
2925-
# TYPE node_rapl_package_joules_total counter
2926-
node_rapl_package_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0"} 240422.366267
2921+
# HELP node_rapl_joules_total Current RAPL value in joules
2922+
# TYPE node_rapl_joules_total counter
2923+
node_rapl_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0",rapl_zone="package"} 240422.366267
2924+
node_rapl_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0:0",rapl_zone="core"} 118821.284256
29272925
# HELP node_schedstat_running_seconds_total Number of seconds CPU spent running a process.
29282926
# TYPE node_schedstat_running_seconds_total counter
29292927
node_schedstat_running_seconds_total{cpu="0"} 2.045936778163039e+06

collector/fixtures/e2e-output.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2940,12 +2940,10 @@ node_qdisc_packets_total{device="wlan0",kind="fq"} 42
29402940
# TYPE node_qdisc_requeues_total counter
29412941
node_qdisc_requeues_total{device="eth0",kind="pfifo_fast"} 2
29422942
node_qdisc_requeues_total{device="wlan0",kind="fq"} 1
2943-
# HELP node_rapl_core_joules_total Current RAPL core value in joules
2944-
# TYPE node_rapl_core_joules_total counter
2945-
node_rapl_core_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0:0"} 118821.284256
2946-
# HELP node_rapl_package_joules_total Current RAPL package value in joules
2947-
# TYPE node_rapl_package_joules_total counter
2948-
node_rapl_package_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0"} 240422.366267
2943+
# HELP node_rapl_joules_total Current RAPL value in joules
2944+
# TYPE node_rapl_joules_total counter
2945+
node_rapl_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0",rapl_zone="package"} 240422.366267
2946+
node_rapl_joules_total{index="0",path="collector/fixtures/sys/class/powercap/intel-rapl:0:0",rapl_zone="core"} 118821.284256
29492947
# HELP node_schedstat_running_seconds_total Number of seconds CPU spent running a process.
29502948
# TYPE node_schedstat_running_seconds_total counter
29512949
node_schedstat_running_seconds_total{cpu="0"} 2.045936778163039e+06

collector/netdev_common.go

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ import (
3030
)
3131

3232
var (
33-
netdevDeviceInclude = kingpin.Flag("collector.netdev.device-include", "Regexp of net devices to include (mutually exclusive to device-exclude).").String()
34-
oldNetdevDeviceInclude = kingpin.Flag("collector.netdev.device-whitelist", "DEPRECATED: Use collector.netdev.device-include").Hidden().String()
35-
netdevDeviceExclude = kingpin.Flag("collector.netdev.device-exclude", "Regexp of net devices to exclude (mutually exclusive to device-include).").String()
36-
oldNetdevDeviceExclude = kingpin.Flag("collector.netdev.device-blacklist", "DEPRECATED: Use collector.netdev.device-exclude").Hidden().String()
37-
netdevAddressInfo = kingpin.Flag("collector.netdev.address-info", "Collect address-info for every device").Bool()
38-
netdevDetailedMetrics = kingpin.Flag("collector.netdev.enable-detailed-metrics", "Use (incompatible) metric names that provide more detailed stats on Linux").Bool()
33+
netdevDeviceInclude = kingpin.Flag("collector.netdev.device-include", "Regexp of net devices to include (mutually exclusive to device-exclude).").String()
34+
netdevDeviceExclude = kingpin.Flag("collector.netdev.device-exclude", "Regexp of net devices to exclude (mutually exclusive to device-include).").String()
35+
netdevAddressInfo = kingpin.Flag("collector.netdev.address-info", "Collect address-info for every device").Bool()
36+
netdevDetailedMetrics = kingpin.Flag("collector.netdev.enable-detailed-metrics", "Use (incompatible) metric names that provide more detailed stats on Linux").Bool()
3937
)
4038

4139
type netDevCollector struct {
@@ -54,24 +52,6 @@ func init() {
5452

5553
// NewNetDevCollector returns a new Collector exposing network device stats.
5654
func NewNetDevCollector(logger *slog.Logger) (Collector, error) {
57-
if *oldNetdevDeviceInclude != "" {
58-
if *netdevDeviceInclude == "" {
59-
logger.Warn("--collector.netdev.device-whitelist is DEPRECATED and will be removed in 2.0.0, use --collector.netdev.device-include")
60-
*netdevDeviceInclude = *oldNetdevDeviceInclude
61-
} else {
62-
return nil, errors.New("--collector.netdev.device-whitelist and --collector.netdev.device-include are mutually exclusive")
63-
}
64-
}
65-
66-
if *oldNetdevDeviceExclude != "" {
67-
if *netdevDeviceExclude == "" {
68-
logger.Warn("--collector.netdev.device-blacklist is DEPRECATED and will be removed in 2.0.0, use --collector.netdev.device-exclude")
69-
*netdevDeviceExclude = *oldNetdevDeviceExclude
70-
} else {
71-
return nil, errors.New("--collector.netdev.device-blacklist and --collector.netdev.device-exclude are mutually exclusive")
72-
}
73-
}
74-
7555
if *netdevDeviceExclude != "" && *netdevDeviceInclude != "" {
7656
return nil, errors.New("device-exclude & device-include are mutually exclusive")
7757
}

collector/ntp.go

Lines changed: 0 additions & 177 deletions
This file was deleted.

collector/qdisc_linux.go

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@ type qdiscStatCollector struct {
4141
}
4242

4343
var (
44-
collectorQdisc = kingpin.Flag("collector.qdisc.fixtures", "test fixtures to use for qdisc collector end-to-end testing").Default("").String()
45-
collectorQdiscDeviceInclude = kingpin.Flag("collector.qdisc.device-include", "Regexp of qdisc devices to include (mutually exclusive to device-exclude).").String()
46-
oldCollectorQdiskDeviceInclude = kingpin.Flag("collector.qdisk.device-include", "DEPRECATED: Use collector.qdisc.device-include").Hidden().String()
47-
collectorQdiscDeviceExclude = kingpin.Flag("collector.qdisc.device-exclude", "Regexp of qdisc devices to exclude (mutually exclusive to device-include).").String()
48-
oldCollectorQdiskDeviceExclude = kingpin.Flag("collector.qdisk.device-exclude", "DEPRECATED: Use collector.qdisc.device-exclude").Hidden().String()
44+
collectorQdisc = kingpin.Flag("collector.qdisc.fixtures", "test fixtures to use for qdisc collector end-to-end testing").Default("").String()
45+
collectorQdiscDeviceInclude = kingpin.Flag("collector.qdisc.device-include", "Regexp of qdisc devices to include (mutually exclusive to device-exclude).").String()
46+
collectorQdiscDeviceExclude = kingpin.Flag("collector.qdisc.device-exclude", "Regexp of qdisc devices to exclude (mutually exclusive to device-include).").String()
4947
)
5048

5149
func init() {
@@ -54,24 +52,6 @@ func init() {
5452

5553
// NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics.
5654
func NewQdiscStatCollector(logger *slog.Logger) (Collector, error) {
57-
if *oldCollectorQdiskDeviceInclude != "" {
58-
if *collectorQdiscDeviceInclude == "" {
59-
logger.Warn("--collector.qdisk.device-include is DEPRECATED and will be removed in 2.0.0, use --collector.qdisc.device-include")
60-
*collectorQdiscDeviceInclude = *oldCollectorQdiskDeviceInclude
61-
} else {
62-
return nil, fmt.Errorf("--collector.qdisk.device-include and --collector.qdisc.device-include are mutually exclusive")
63-
}
64-
}
65-
66-
if *oldCollectorQdiskDeviceExclude != "" {
67-
if *collectorQdiscDeviceExclude == "" {
68-
logger.Warn("--collector.qdisk.device-exclude is DEPRECATED and will be removed in 2.0.0, use --collector.qdisc.device-exclude")
69-
*collectorQdiscDeviceExclude = *oldCollectorQdiskDeviceExclude
70-
} else {
71-
return nil, fmt.Errorf("--collector.qdisk.device-exclude and --collector.qdisc.device-exclude are mutually exclusive")
72-
}
73-
}
74-
7555
if *collectorQdiscDeviceExclude != "" && *collectorQdiscDeviceInclude != "" {
7656
return nil, fmt.Errorf("collector.qdisc.device-include and collector.qdisc.device-exclude are mutaly exclusive")
7757
}

collector/rapl_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func init() {
4242
}
4343

4444
var (
45-
raplZoneLabel = kingpin.Flag("collector.rapl.enable-zone-label", "Enables service unit metric unit_start_time_seconds").Bool()
45+
raplZoneLabel = kingpin.Flag("collector.rapl.enable-zone-label", "Enables service unit metric unit_start_time_seconds").Default("true").Bool()
4646
)
4747

4848
// NewRaplCollector returns a new Collector exposing RAPL metrics.

0 commit comments

Comments
 (0)