mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-11-23 12:30:46 +01:00
Update logic
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
2e20d668f2
commit
99af1dbb44
@ -120,7 +120,9 @@ func NewNodeCollector(logger log.Logger, filters ...string) (*NodeCollector, err
|
||||
initiatedCollectorsMtx.Lock()
|
||||
defer initiatedCollectorsMtx.Unlock()
|
||||
for key, enabled := range collectorState {
|
||||
if *enabled {
|
||||
if !*enabled || (len(f) > 0 && !f[key]) {
|
||||
continue
|
||||
}
|
||||
if collector, ok := initiatedCollectors[key]; ok {
|
||||
collectors[key] = collector
|
||||
} else {
|
||||
@ -128,13 +130,10 @@ func NewNodeCollector(logger log.Logger, filters ...string) (*NodeCollector, err
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(f) == 0 || f[key] {
|
||||
collectors[key] = collector
|
||||
initiatedCollectors[key] = collector
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return &NodeCollector{Collectors: collectors, logger: logger}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user