|
|
@ -120,19 +120,18 @@ func NewNodeCollector(logger log.Logger, filters ...string) (*NodeCollector, err
|
|
|
|
initiatedCollectorsMtx.Lock()
|
|
|
|
initiatedCollectorsMtx.Lock()
|
|
|
|
defer initiatedCollectorsMtx.Unlock()
|
|
|
|
defer initiatedCollectorsMtx.Unlock()
|
|
|
|
for key, enabled := range collectorState {
|
|
|
|
for key, enabled := range collectorState {
|
|
|
|
if *enabled {
|
|
|
|
if !*enabled || (len(f) > 0 && !f[key]) {
|
|
|
|
if collector, ok := initiatedCollectors[key]; ok {
|
|
|
|
continue
|
|
|
|
collectors[key] = collector
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if collector, ok := initiatedCollectors[key]; ok {
|
|
|
|
collector, err := factories[key](log.With(logger, "collector", key))
|
|
|
|
collectors[key] = collector
|
|
|
|
if err != nil {
|
|
|
|
} else {
|
|
|
|
return nil, err
|
|
|
|
collector, err := factories[key](log.With(logger, "collector", key))
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
if len(f) == 0 || f[key] {
|
|
|
|
return nil, err
|
|
|
|
collectors[key] = collector
|
|
|
|
|
|
|
|
initiatedCollectors[key] = collector
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
collectors[key] = collector
|
|
|
|
|
|
|
|
initiatedCollectors[key] = collector
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &NodeCollector{Collectors: collectors, logger: logger}, nil
|
|
|
|
return &NodeCollector{Collectors: collectors, logger: logger}, nil
|
|
|
|