mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 12:30:46 +01:00
fix(qdisc) flag naming corrected for consistency (#2782)
* fix collector qdisc flag naming for consistency --------- Signed-off-by: jbradleynh <jbradley@fastly.com>
This commit is contained in:
parent
e120d958f5
commit
f2b274350a
@ -25,6 +25,7 @@ import (
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/ema/qdisc"
|
||||
"github.com/go-kit/log"
|
||||
"github.com/go-kit/log/level"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
||||
|
||||
@ -41,9 +42,11 @@ type qdiscStatCollector struct {
|
||||
}
|
||||
|
||||
var (
|
||||
collectorQdisc = kingpin.Flag("collector.qdisc.fixtures", "test fixtures to use for qdisc collector end-to-end testing").Default("").String()
|
||||
collectorQdiskDeviceInclude = kingpin.Flag("collector.qdisk.device-include", "Regexp of qdisk devices to include (mutually exclusive to device-exclude).").String()
|
||||
collectorQdiskDeviceExclude = kingpin.Flag("collector.qdisk.device-exclude", "Regexp of qdisk devices to exclude (mutually exclusive to device-include).").String()
|
||||
collectorQdisc = kingpin.Flag("collector.qdisc.fixtures", "test fixtures to use for qdisc collector end-to-end testing").Default("").String()
|
||||
collectorQdiscDeviceInclude = kingpin.Flag("collector.qdisc.device-include", "Regexp of qdisc devices to include (mutually exclusive to device-exclude).").String()
|
||||
oldCollectorQdiskDeviceInclude = kingpin.Flag("collector.qdisk.device-include", "DEPRECATED: Use collector.qdisc.device-include").Hidden().String()
|
||||
collectorQdiscDeviceExclude = kingpin.Flag("collector.qdisc.device-exclude", "Regexp of qdisc devices to exclude (mutually exclusive to device-include).").String()
|
||||
oldCollectorQdiskDeviceExclude = kingpin.Flag("collector.qdisk.device-exclude", "DEPRECATED: Use collector.qdisc.device-exclude").Hidden().String()
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -52,8 +55,26 @@ func init() {
|
||||
|
||||
// NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics.
|
||||
func NewQdiscStatCollector(logger log.Logger) (Collector, error) {
|
||||
if *collectorQdiskDeviceExclude != "" && *collectorQdiskDeviceInclude != "" {
|
||||
return nil, fmt.Errorf("collector.qdisk.device-include and collector.qdisk.device-exclude are mutaly exclusive")
|
||||
if *oldCollectorQdiskDeviceInclude != "" {
|
||||
if *collectorQdiscDeviceInclude == "" {
|
||||
level.Warn(logger).Log("msg", "--collector.qdisk.device-include is DEPRECATED and will be removed in 2.0.0, use --collector.qdisc.device-include")
|
||||
*collectorQdiscDeviceInclude = *oldCollectorQdiskDeviceInclude
|
||||
} else {
|
||||
return nil, fmt.Errorf("--collector.qdisk.device-include and --collector.qdisc.device-include are mutually exclusive")
|
||||
}
|
||||
}
|
||||
|
||||
if *oldCollectorQdiskDeviceExclude != "" {
|
||||
if *collectorQdiscDeviceExclude == "" {
|
||||
level.Warn(logger).Log("msg", "--collector.qdisk.device-exclude is DEPRECATED and will be removed in 2.0.0, use --collector.qdisc.device-exclude")
|
||||
*collectorQdiscDeviceExclude = *oldCollectorQdiskDeviceExclude
|
||||
} else {
|
||||
return nil, fmt.Errorf("--collector.qdisk.device-exclude and --collector.qdisc.device-exclude are mutually exclusive")
|
||||
}
|
||||
}
|
||||
|
||||
if *collectorQdiscDeviceExclude != "" && *collectorQdiscDeviceInclude != "" {
|
||||
return nil, fmt.Errorf("collector.qdisc.device-include and collector.qdisc.device-exclude are mutaly exclusive")
|
||||
}
|
||||
|
||||
return &qdiscStatCollector{
|
||||
@ -93,7 +114,7 @@ func NewQdiscStatCollector(logger log.Logger) (Collector, error) {
|
||||
[]string{"device", "kind"}, nil,
|
||||
), prometheus.GaugeValue},
|
||||
logger: logger,
|
||||
deviceFilter: newDeviceFilter(*collectorQdiskDeviceExclude, *collectorQdiskDeviceExclude),
|
||||
deviceFilter: newDeviceFilter(*collectorQdiscDeviceExclude, *collectorQdiscDeviceInclude),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ fi
|
||||
--collector.textfile.directory="collector/fixtures/textfile/two_metric_files/" \
|
||||
--collector.wifi.fixtures="collector/fixtures/wifi" \
|
||||
--collector.qdisc.fixtures="collector/fixtures/qdisc/" \
|
||||
--collector.qdisk.device-include="(wlan0|eth0)" \
|
||||
--collector.qdisc.device-include="(wlan0|eth0)" \
|
||||
--collector.arp.device-exclude="nope" \
|
||||
--collector.hwmon.chip-include="(applesmc|coretemp|hwmon4|nct6779)" \
|
||||
--collector.netclass.ignored-devices="(dmz|int)" \
|
||||
|
Loading…
Reference in New Issue
Block a user