collector: export NodeCollector for documentation purposes

Signed-off-by: Matt Layher <mdlayher@gmail.com>
This commit is contained in:
Matt Layher 2018-10-26 15:39:33 -04:00
parent 7519967619
commit 2c2ee93519
No known key found for this signature in database
GPG Key ID: 77BFE531397EDE94
1 changed files with 6 additions and 6 deletions

View File

@ -71,12 +71,12 @@ func registerCollector(collector string, isDefaultEnabled bool, factory func() (
} }
// NodeCollector implements the prometheus.Collector interface. // NodeCollector implements the prometheus.Collector interface.
type nodeCollector struct { type NodeCollector struct {
Collectors map[string]Collector Collectors map[string]Collector
} }
// NewNodeCollector creates a new NodeCollector // NewNodeCollector creates a new NodeCollector.
func NewNodeCollector(filters ...string) (*nodeCollector, error) { func NewNodeCollector(filters ...string) (*NodeCollector, error) {
f := make(map[string]bool) f := make(map[string]bool)
for _, filter := range filters { for _, filter := range filters {
enabled, exist := collectorState[filter] enabled, exist := collectorState[filter]
@ -100,17 +100,17 @@ func NewNodeCollector(filters ...string) (*nodeCollector, error) {
} }
} }
} }
return &nodeCollector{Collectors: collectors}, nil return &NodeCollector{Collectors: collectors}, nil
} }
// Describe implements the prometheus.Collector interface. // Describe implements the prometheus.Collector interface.
func (n nodeCollector) Describe(ch chan<- *prometheus.Desc) { func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- scrapeDurationDesc ch <- scrapeDurationDesc
ch <- scrapeSuccessDesc ch <- scrapeSuccessDesc
} }
// Collect implements the prometheus.Collector interface. // Collect implements the prometheus.Collector interface.
func (n nodeCollector) Collect(ch chan<- prometheus.Metric) { func (n NodeCollector) Collect(ch chan<- prometheus.Metric) {
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
wg.Add(len(n.Collectors)) wg.Add(len(n.Collectors))
for name, c := range n.Collectors { for name, c := range n.Collectors {