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

@@ -15,15 +15,14 @@ import (
"github.com/yusufpapurcu/wmi"
)
const (
FlagProcessBlacklist = "collector.process.blacklist"
FlagProcessWhitelist = "collector.process.whitelist"
)
var (
processWhitelist = kingpin.Flag(
"collector.process.whitelist",
"Regexp of processes to include. Process name must both match whitelist and not match blacklist to be included.",
).Default(".*").String()
processBlacklist = kingpin.Flag(
"collector.process.blacklist",
"Regexp of processes to exclude. Process name must both match whitelist and not match blacklist to be included.",
).Default("").String()
processWhitelist *string
processBlacklist *string
)
type processCollector struct {
@@ -47,6 +46,18 @@ type processCollector struct {
processBlacklistPattern *regexp.Regexp
}
// newProcessCollectorFlags ...
func newProcessCollectorFlags(app *kingpin.Application) {
processWhitelist = app.Flag(
FlagProcessWhitelist,
"Regexp of processes to include. Process name must both match whitelist and not match blacklist to be included.",
).Default(".*").String()
processBlacklist = app.Flag(
FlagProcessBlacklist,
"Regexp of processes to exclude. Process name must both match whitelist and not match blacklist to be included.",
).Default("").String()
}
// NewProcessCollector ...
func newProcessCollector() (Collector, error) {
const subsystem = "process"