fix(qdisc) flag naming corrected for consistency (#2782)

* fix collector qdisc flag naming for consistency

---------

Signed-off-by: jbradleynh <jbradley@fastly.com>
pull/2786/head
Josh Bradley 1 year ago committed by GitHub
parent e120d958f5
commit f2b274350a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,6 +25,7 @@ import (
"github.com/alecthomas/kingpin/v2" "github.com/alecthomas/kingpin/v2"
"github.com/ema/qdisc" "github.com/ema/qdisc"
"github.com/go-kit/log" "github.com/go-kit/log"
"github.com/go-kit/log/level"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )
@ -42,8 +43,10 @@ type qdiscStatCollector struct {
var ( var (
collectorQdisc = kingpin.Flag("collector.qdisc.fixtures", "test fixtures to use for qdisc collector end-to-end testing").Default("").String() 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() collectorQdiscDeviceInclude = kingpin.Flag("collector.qdisc.device-include", "Regexp of qdisc 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() 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() { func init() {
@ -52,8 +55,26 @@ func init() {
// NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics. // NewQdiscStatCollector returns a new Collector exposing queuing discipline statistics.
func NewQdiscStatCollector(logger log.Logger) (Collector, error) { func NewQdiscStatCollector(logger log.Logger) (Collector, error) {
if *collectorQdiskDeviceExclude != "" && *collectorQdiskDeviceInclude != "" { if *oldCollectorQdiskDeviceInclude != "" {
return nil, fmt.Errorf("collector.qdisk.device-include and collector.qdisk.device-exclude are mutaly exclusive") 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{ return &qdiscStatCollector{
@ -93,7 +114,7 @@ func NewQdiscStatCollector(logger log.Logger) (Collector, error) {
[]string{"device", "kind"}, nil, []string{"device", "kind"}, nil,
), prometheus.GaugeValue}, ), prometheus.GaugeValue},
logger: logger, logger: logger,
deviceFilter: newDeviceFilter(*collectorQdiskDeviceExclude, *collectorQdiskDeviceExclude), deviceFilter: newDeviceFilter(*collectorQdiscDeviceExclude, *collectorQdiscDeviceInclude),
}, nil }, nil
} }

@ -130,7 +130,7 @@ fi
--collector.textfile.directory="collector/fixtures/textfile/two_metric_files/" \ --collector.textfile.directory="collector/fixtures/textfile/two_metric_files/" \
--collector.wifi.fixtures="collector/fixtures/wifi" \ --collector.wifi.fixtures="collector/fixtures/wifi" \
--collector.qdisc.fixtures="collector/fixtures/qdisc/" \ --collector.qdisc.fixtures="collector/fixtures/qdisc/" \
--collector.qdisk.device-include="(wlan0|eth0)" \ --collector.qdisc.device-include="(wlan0|eth0)" \
--collector.arp.device-exclude="nope" \ --collector.arp.device-exclude="nope" \
--collector.hwmon.chip-include="(applesmc|coretemp|hwmon4|nct6779)" \ --collector.hwmon.chip-include="(applesmc|coretemp|hwmon4|nct6779)" \
--collector.netclass.ignored-devices="(dmz|int)" \ --collector.netclass.ignored-devices="(dmz|int)" \

Loading…
Cancel
Save