in pkg/metrics/collector/collector.go [68:87]
func NewNodeCollector(enabledCollectors []string, proc string, stack string) (*NodeCollector, []prometheus.Collector, error) {
procPath = proc
stackType = stack
collectors := make(map[string]Collector)
for _, name := range enabledCollectors {
createFunc, exist := factories[name]
if !exist {
return nil, nil, fmt.Errorf("missing collector: %q", name)
}
if c, err := createFunc(); err == nil {
collectors[name] = c
} else {
return nil, nil, err
}
glog.Infof("Intializing metrics: %v", name)
}
return &NodeCollector{Collectors: collectors, startTime: time.Now().Unix()},
[]prometheus.Collector{scrapeDurationHist, scrapeFailureCount},
nil
}