diff --git a/pkg/cmd/collect.go b/pkg/cmd/collect.go index 0aab4a88..32f6242c 100644 --- a/pkg/cmd/collect.go +++ b/pkg/cmd/collect.go @@ -126,7 +126,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.Default) + defaultCollectorNames = append(defaultCollectorNames, runner.All) collectCmd.Flags().StringSliceVarP( &collectorNames, "collector", @@ -135,11 +135,9 @@ func init() { //nolint:funlen // Allow this to get a little long fmt.Sprintf( "the collectors you wish to run (case-insensitive):\n"+ "\trequired collectors: %s (will be automatically added)\n"+ - "\toptional collectors: %s\n"+ - "\topt in collectors: %s (note: these are not included by default)", + "\toptional collectors: %s", strings.Join(runner.RequiredCollectorNames, ", "), strings.Join(runner.OptionalCollectorNames, ", "), - strings.Join(runner.OptInCollectorNames, ", "), ), ) diff --git a/pkg/collectors/dpll_collector.go b/pkg/collectors/dpll_collector.go index 8dcf9e7c..12c6c25a 100644 --- a/pkg/collectors/dpll_collector.go +++ b/pkg/collectors/dpll_collector.go @@ -108,5 +108,5 @@ func NewDPLLCollector(constructor *CollectionConstructor) (Collector, error) { } func init() { - RegisterCollector(DPLLCollectorName, NewDPLLCollector, includeByDefault) + RegisterCollector(DPLLCollectorName, NewDPLLCollector, optional) } diff --git a/pkg/collectors/gps_ubx_collector.go b/pkg/collectors/gps_ubx_collector.go index a64dc65e..73bbc72b 100644 --- a/pkg/collectors/gps_ubx_collector.go +++ b/pkg/collectors/gps_ubx_collector.go @@ -94,5 +94,5 @@ func NewGPSCollector(constructor *CollectionConstructor) (Collector, error) { } func init() { - RegisterCollector(GPSCollectorName, NewGPSCollector, includeByDefault) + RegisterCollector(GPSCollectorName, NewGPSCollector, optional) } diff --git a/pkg/collectors/log_follower.go b/pkg/collectors/log_follower.go index c2e0d571..3fc9c0d0 100644 --- a/pkg/collectors/log_follower.go +++ b/pkg/collectors/log_follower.go @@ -294,5 +294,5 @@ func NewLogsCollector(constructor *CollectionConstructor) (Collector, error) { func init() { // Make log opt in as in may lose some data. - RegisterCollector(LogsCollectorName, NewLogsCollector, includeByDefault) + RegisterCollector(LogsCollectorName, NewLogsCollector, optional) } diff --git a/pkg/collectors/pmc_collector.go b/pkg/collectors/pmc_collector.go index 1d166306..2f4c3f40 100644 --- a/pkg/collectors/pmc_collector.go +++ b/pkg/collectors/pmc_collector.go @@ -92,5 +92,5 @@ func NewPMCCollector(constructor *CollectionConstructor) (Collector, error) { } func init() { - RegisterCollector(PMCCollectorName, NewPMCCollector, includeByDefault) + RegisterCollector(PMCCollectorName, NewPMCCollector, optional) } diff --git a/pkg/collectors/registry.go b/pkg/collectors/registry.go index 87a015b1..bef2adc8 100644 --- a/pkg/collectors/registry.go +++ b/pkg/collectors/registry.go @@ -12,15 +12,13 @@ type collectorInclusionType int const ( required collectorInclusionType = iota - includeByDefault - optIn + optional ) type CollectorRegistry struct { registry map[string]collectonBuilderFunc required []string optional []string - optIn []string } var registry *CollectorRegistry @@ -38,10 +36,8 @@ func (reg *CollectorRegistry) register( switch inclusionType { case required: reg.required = append(reg.required, collectorName) - case includeByDefault: + case optional: reg.optional = append(reg.optional, collectorName) - case optIn: - reg.optIn = append(reg.optIn, collectorName) default: log.Panic("Incorrect collector inclusion type") } @@ -63,17 +59,12 @@ func (reg *CollectorRegistry) GetOptionalNames() []string { return reg.optional } -func (reg *CollectorRegistry) GetOptInNames() []string { - return reg.optIn -} - func RegisterCollector(collectorName string, builderFunc collectonBuilderFunc, inclusionType collectorInclusionType) { if registry == nil { registry = &CollectorRegistry{ registry: make(map[string]collectonBuilderFunc, 0), required: make([]string, 0), optional: make([]string, 0), - optIn: make([]string, 0), } } registry.register(collectorName, builderFunc, inclusionType) diff --git a/pkg/runner/collector_selector.go b/pkg/runner/collector_selector.go index c3603def..4b2e6b60 100644 --- a/pkg/runner/collector_selector.go +++ b/pkg/runner/collector_selector.go @@ -13,8 +13,6 @@ import ( var ( OptionalCollectorNames []string RequiredCollectorNames []string - OptInCollectorNames []string - Default string = "defaults" All string = "all" ) @@ -22,7 +20,6 @@ func init() { registry := collectors.GetRegistry() OptionalCollectorNames = registry.GetOptionalNames() RequiredCollectorNames = registry.GetRequiredNames() - OptInCollectorNames = registry.GetOptInNames() } func isIn(name string, arr []string) bool { @@ -54,15 +51,12 @@ func GetCollectorsToRun(selectedCollectors []string) []string { switch { case strings.EqualFold(name, "all"): collectorNames = append(collectorNames, OptionalCollectorNames...) - collectorNames = append(collectorNames, OptInCollectorNames...) case strings.EqualFold(name, "defaults"): collectorNames = append(collectorNames, OptionalCollectorNames...) case isIn(name, collectorNames): continue case isIn(name, OptionalCollectorNames): collectorNames = append(collectorNames, name) - case isIn(name, OptInCollectorNames): - collectorNames = append(collectorNames, name) default: log.Errorf("Unknown collector %s. Ignored", name) }