Skip to content

Commit

Permalink
Don't short circuit collector names and change collector selector def…
Browse files Browse the repository at this point in the history
…ualt names

- Change all to defaults and include opt in collectors for All
  • Loading branch information
nocturnalastro committed Oct 5, 2023
1 parent b21d5b3 commit 51c10e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func init() { //nolint:funlen // Allow this to get a little long
"interval at which to emit the device info summary to the targeted output.",
)
defaultCollectorNames := make([]string, 0)
defaultCollectorNames = append(defaultCollectorNames, runner.All)
defaultCollectorNames = append(defaultCollectorNames, runner.Default)
collectCmd.Flags().StringSliceVarP(
&collectorNames,
"collector",
Expand Down
7 changes: 5 additions & 2 deletions pkg/runner/collector_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var (
OptionalCollectorNames []string
RequiredCollectorNames []string
OptInCollectorNames []string
Default string = "defaults"
All string = "all"
)

Expand Down Expand Up @@ -53,8 +54,9 @@ func GetCollectorsToRun(selectedCollectors []string) []string {
switch {
case strings.EqualFold(name, "all"):
collectorNames = append(collectorNames, OptionalCollectorNames...)
collectorNames = removeDuplicates(collectorNames)
return collectorNames
collectorNames = append(collectorNames, OptInCollectorNames...)
case strings.EqualFold(name, "defaults"):
collectorNames = append(collectorNames, OptionalCollectorNames...)
case isIn(name, collectorNames):
continue
case isIn(name, OptionalCollectorNames):
Expand All @@ -65,5 +67,6 @@ func GetCollectorsToRun(selectedCollectors []string) []string {
log.Errorf("Unknown collector %s. Ignored", name)
}
}
collectorNames = removeDuplicates(collectorNames)
return collectorNames
}

0 comments on commit 51c10e1

Please sign in to comment.