Remove fluent-style kingpin

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2023-04-16 11:45:07 +02:00
parent a105e088b3
commit da6898afc4
15 changed files with 487 additions and 252 deletions

View File

@@ -12,15 +12,14 @@ import (
"github.com/prometheus/client_golang/prometheus"
)
const (
FlagLogicalDiskVolumeBlacklist = "collector.logical_disk.volume-blacklist"
FlagLogicalDiskVolumeWhitelist = "collector.logical_disk.volume-whitelist"
)
var (
volumeWhitelist = kingpin.Flag(
"collector.logical_disk.volume-whitelist",
"Regexp of volumes to whitelist. Volume name must both match whitelist and not match blacklist to be included.",
).Default(".+").String()
volumeBlacklist = kingpin.Flag(
"collector.logical_disk.volume-blacklist",
"Regexp of volumes to blacklist. Volume name must both match whitelist and not match blacklist to be included.",
).Default("").String()
volumeWhitelist *string
volumeBlacklist *string
)
// A LogicalDiskCollector is a Prometheus collector for perflib logicalDisk metrics
@@ -46,6 +45,18 @@ type LogicalDiskCollector struct {
volumeBlacklistPattern *regexp.Regexp
}
// newLogicalDiskCollectorFlags ...
func newLogicalDiskCollectorFlags(app *kingpin.Application) {
volumeWhitelist = app.Flag(
FlagLogicalDiskVolumeWhitelist,
"Regexp of volumes to whitelist. Volume name must both match whitelist and not match blacklist to be included.",
).Default(".+").String()
volumeBlacklist = app.Flag(
FlagLogicalDiskVolumeBlacklist,
"Regexp of volumes to blacklist. Volume name must both match whitelist and not match blacklist to be included.",
).Default("").String()
}
// newLogicalDiskCollector ...
func newLogicalDiskCollector() (Collector, error) {
const subsystem = "logical_disk"