Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: don't exclude resources, if empty exclude is empty. #1680

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/collector/iis/iis.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,22 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.iis.app-exclude",
"Regexp of apps to exclude. App name must both match include and not match exclude to be included.",
).Default(c.config.AppExclude.String()).StringVar(&appExclude)
).Default("").StringVar(&appExclude)

app.Flag(
"collector.iis.app-include",
"Regexp of apps to include. App name must both match include and not match exclude to be included.",
).Default(c.config.AppInclude.String()).StringVar(&appInclude)
).Default(".+").StringVar(&appInclude)

app.Flag(
"collector.iis.site-exclude",
"Regexp of sites to exclude. Site name must both match include and not match exclude to be included.",
).Default(c.config.SiteExclude.String()).StringVar(&siteExclude)
).Default("").StringVar(&siteExclude)

app.Flag(
"collector.iis.site-include",
"Regexp of sites to include. Site name must both match include and not match exclude to be included.",
).Default(c.config.SiteInclude.String()).StringVar(&siteInclude)
).Default(".+").StringVar(&siteInclude)

app.Action(func(*kingpin.ParseContext) error {
var err error
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/logical_disk/logical_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.logical_disk.volume-exclude",
"Regexp of volumes to exclude. Volume name must both match include and not match exclude to be included.",
).Default(c.config.VolumeExclude.String()).StringVar(&volumeExclude)
).Default("").StringVar(&volumeExclude)

app.Flag(
"collector.logical_disk.volume-include",
"Regexp of volumes to include. Volume name must both match include and not match exclude to be included.",
).Default(c.config.VolumeInclude.String()).StringVar(&volumeInclude)
).Default(".+").StringVar(&volumeInclude)

app.Action(func(*kingpin.ParseContext) error {
var err error
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/net/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.net.nic-exclude",
"Regexp of NIC:s to exclude. NIC name must both match include and not match exclude to be included.",
).Default(c.config.NicExclude.String()).StringVar(&nicExclude)
).Default("").StringVar(&nicExclude)

app.Flag(
"collector.net.nic-include",
"Regexp of NIC:s to include. NIC name must both match include and not match exclude to be included.",
).Default(c.config.NicInclude.String()).StringVar(&nicInclude)
).Default(".+").StringVar(&nicInclude)

app.Flag(
"collector.net.enabled",
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/physical_disk/physical_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.physical_disk.disk-exclude",
"Regexp of disks to exclude. Disk number must both match include and not match exclude to be included.",
).Default(c.config.DiskExclude.String()).StringVar(&diskExclude)
).Default("").StringVar(&diskExclude)

app.Flag(
"collector.physical_disk.disk-include",
"Regexp of disks to include. Disk number must both match include and not match exclude to be included.",
).Default(c.config.DiskInclude.String()).StringVar(&diskInclude)
).Default(".+").StringVar(&diskInclude)

app.Action(func(*kingpin.ParseContext) error {
var err error
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.printer.include",
"Regular expression to match printers to collect metrics for",
).Default(c.config.PrinterInclude.String()).StringVar(&printerInclude)
).Default(".+").StringVar(&printerInclude)

app.Flag(
"collector.printer.exclude",
"Regular expression to match printers to exclude",
).Default(c.config.PrinterExclude.String()).StringVar(&printerExclude)
).Default("").StringVar(&printerExclude)

app.Action(func(*kingpin.ParseContext) error {
var err error
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.process.exclude",
"Regexp of processes to exclude. Process name must both match include and not match exclude to be included.",
).Default(c.config.ProcessExclude.String()).StringVar(&processExclude)
).Default("").StringVar(&processExclude)

app.Flag(
"collector.process.include",
"Regexp of processes to include. Process name must both match include and not match exclude to be included.",
).Default(c.config.ProcessInclude.String()).StringVar(&processInclude)
).Default(".+").StringVar(&processInclude)

app.Flag(
"collector.process.iis",
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/scheduled_task/scheduled_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.scheduled_task.exclude",
"Regexp of tasks to exclude. Task path must both match include and not match exclude to be included.",
).Default(c.config.TaskExclude.String()).StringVar(&taskExclude)
).Default("").StringVar(&taskExclude)

app.Flag(
"collector.scheduled_task.include",
"Regexp of tasks to include. Task path must both match include and not match exclude to be included.",
).Default(c.config.TaskInclude.String()).StringVar(&taskInclude)
).Default(".+").StringVar(&taskInclude)

app.Action(func(*kingpin.ParseContext) error {
var err error
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.service.exclude",
"Regexp of service to exclude. Service name (not the display name!) must both match include and not match exclude to be included.",
).Default(c.config.ServiceExclude.String()).StringVar(&serviceExclude)
).Default("").StringVar(&serviceExclude)

app.Flag(
"collector.service.include",
"Regexp of service to include. Process name (not the display name!) must both match include and not match exclude to be included.",
).Default(c.config.ServiceInclude.String()).StringVar(&serviceInclude)
).Default(".+").StringVar(&serviceInclude)

app.Action(func(*kingpin.ParseContext) error {
var err error
Expand Down
4 changes: 2 additions & 2 deletions internal/collector/smtp/smtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ func NewWithFlags(app *kingpin.Application) *Collector {
app.Flag(
"collector.smtp.server-exclude",
"Regexp of virtual servers to exclude. Server name must both match include and not match exclude to be included.",
).Default(c.config.ServerExclude.String()).StringVar(&serverExclude)
).Default("").StringVar(&serverExclude)

app.Flag(
"collector.smtp.server-include",
"Regexp of virtual servers to include. Server name must both match include and not match exclude to be included.",
).Default(c.config.ServerInclude.String()).StringVar(&serverInclude)
).Default(".+").StringVar(&serverInclude)

app.Action(func(*kingpin.ParseContext) error {
var err error
Expand Down
4 changes: 2 additions & 2 deletions internal/types/regexp.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package types
import "regexp"

var (
RegExpAny = regexp.MustCompile("^(?:.+)$")
RegExpEmpty = regexp.MustCompile("^(?:)$")
RegExpAny = regexp.MustCompile("^.+$")
RegExpEmpty = regexp.MustCompile("^$")
)