You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update netdev and systemd collectors to deprecate poorly chosen flag names.
Old flag names to be removed in 2.0.0.
prometheus#1742
Add log messages for parsed flag values to help discover quoting isuses in
supervisors.
prometheus#1737
Signed-off-by: Ben Kochie <superq@gmail.com>
Copy file name to clipboardExpand all lines: collector/netdev_common.go
+44-21Lines changed: 44 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -23,21 +23,24 @@ import (
23
23
"strconv"
24
24
25
25
"github.com/go-kit/kit/log"
26
+
"github.com/go-kit/kit/log/level"
26
27
"github.com/prometheus/client_golang/prometheus"
27
28
"gopkg.in/alecthomas/kingpin.v2"
28
29
)
29
30
30
31
var (
31
-
netdevIgnoredDevices=kingpin.Flag("collector.netdev.device-blacklist", "Regexp of net devices to blacklist (mutually exclusive to device-whitelist).").String()
32
-
netdevAcceptDevices=kingpin.Flag("collector.netdev.device-whitelist", "Regexp of net devices to whitelist (mutually exclusive to device-blacklist).").String()
32
+
netdevDeviceInclude=kingpin.Flag("collector.netdev.device-include", "Regexp of net devices to include (mutually exclusive to device-exclude).").String()
33
+
oldNetdevDeviceInclude=kingpin.Flag("collector.netdev.device-whitelist", "DEPRECATED: Use collector.netdev.device-include").Hidden().String()
34
+
netdevDeviceExclude=kingpin.Flag("collector.netdev.device-exclude", "Regexp of net devices to exclude (mutually exclusive to device-include).").String()
35
+
oldNetdevDeviceExclude=kingpin.Flag("collector.netdev.device-blacklist", "DEPRECATED: Use collector.netdev.device-exclude").Hidden().String()
33
36
)
34
37
35
38
typenetDevCollectorstruct {
36
-
subsystemstring
37
-
ignoredDevicesPattern*regexp.Regexp
38
-
acceptDevicesPattern*regexp.Regexp
39
-
metricDescsmap[string]*prometheus.Desc
40
-
loggerlog.Logger
39
+
subsystemstring
40
+
deviceExcludePattern*regexp.Regexp
41
+
deviceIncludePattern*regexp.Regexp
42
+
metricDescsmap[string]*prometheus.Desc
43
+
logger log.Logger
41
44
}
42
45
43
46
funcinit() {
@@ -46,31 +49,51 @@ func init() {
46
49
47
50
// NewNetDevCollector returns a new Collector exposing network device stats.
Copy file name to clipboardExpand all lines: collector/systemd_linux.go
+33-11Lines changed: 33 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@
16
16
package collector
17
17
18
18
import (
19
+
"errors"
19
20
"fmt"
20
21
"math"
21
22
"regexp"
@@ -39,8 +40,10 @@ const (
39
40
)
40
41
41
42
var (
42
-
unitWhitelist=kingpin.Flag("collector.systemd.unit-whitelist", "Regexp of systemd units to whitelist. Units must both match whitelist and not match blacklist to be included.").Default(".+").String()
43
-
unitBlacklist=kingpin.Flag("collector.systemd.unit-blacklist", "Regexp of systemd units to blacklist. Units must both match whitelist and not match blacklist to be included.").Default(".+\\.(automount|device|mount|scope|slice)").String()
43
+
unitInclude=kingpin.Flag("collector.systemd.unit-include", "Regexp of systemd units to include. Units must both match include and not match exclude to be included.").Default(".+").String()
44
+
oldUnitInclude=kingpin.Flag("collector.systemd.unit-whitelist", "DEPRECATED: Use --collector.systemd.unit-include").Hidden().String()
45
+
unitExclude=kingpin.Flag("collector.systemd.unit-exclude", "Regexp of systemd units to exclude. Units must both match include and not match exclude to be included.").Default(".+\\.(automount|device|mount|scope|slice)").String()
46
+
oldUnitExclude=kingpin.Flag("collector.systemd.unit-blacklist", "DEPRECATED: Use collector.systemd.unit-exclude").Hidden().String()
44
47
systemdPrivate=kingpin.Flag("collector.systemd.private", "Establish a private, direct connection to systemd without dbus (Strongly discouraged since it requires root. For testing purposes only).").Hidden().Bool()
45
48
enableTaskMetrics=kingpin.Flag("collector.systemd.enable-task-metrics", "Enables service unit tasks metrics unit_tasks_current and unit_tasks_max").Bool()
46
49
enableRestartsMetrics=kingpin.Flag("collector.systemd.enable-restarts-metrics", "Enables service unit metric service_restart_total").Bool()
0 commit comments