aboutsummaryrefslogtreecommitdiff
path: root/collector
diff options
context:
space:
mode:
authorMatt Layher <mdlayher@gmail.com>2018-10-26 15:39:33 -0400
committerMatt Layher <mdlayher@gmail.com>2018-10-26 15:42:00 -0400
commit2c2ee935194a7b21d8ddc750e8631a18a2c4ed0a (patch)
treecc893daa230dbe6c5b5467ab65aa413be36d2a7f /collector
parent751996761903af4cffe18cf2d980b8ae9a202204 (diff)
downloadprometheus_node_collector-2c2ee935194a7b21d8ddc750e8631a18a2c4ed0a.tar.bz2
prometheus_node_collector-2c2ee935194a7b21d8ddc750e8631a18a2c4ed0a.tar.xz
prometheus_node_collector-2c2ee935194a7b21d8ddc750e8631a18a2c4ed0a.zip
collector: export NodeCollector for documentation purposes
Signed-off-by: Matt Layher <mdlayher@gmail.com>
Diffstat (limited to 'collector')
-rw-r--r--collector/collector.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/collector/collector.go b/collector/collector.go
index f657a66..4b74b89 100644
--- a/collector/collector.go
+++ b/collector/collector.go
@@ -71,12 +71,12 @@ func registerCollector(collector string, isDefaultEnabled bool, factory func() (
71} 71}
72 72
73// NodeCollector implements the prometheus.Collector interface. 73// NodeCollector implements the prometheus.Collector interface.
74type nodeCollector struct { 74type NodeCollector struct {
75 Collectors map[string]Collector 75 Collectors map[string]Collector
76} 76}
77 77
78// NewNodeCollector creates a new NodeCollector 78// NewNodeCollector creates a new NodeCollector.
79func NewNodeCollector(filters ...string) (*nodeCollector, error) { 79func NewNodeCollector(filters ...string) (*NodeCollector, error) {
80 f := make(map[string]bool) 80 f := make(map[string]bool)
81 for _, filter := range filters { 81 for _, filter := range filters {
82 enabled, exist := collectorState[filter] 82 enabled, exist := collectorState[filter]
@@ -100,17 +100,17 @@ func NewNodeCollector(filters ...string) (*nodeCollector, error) {
100 } 100 }
101 } 101 }
102 } 102 }
103 return &nodeCollector{Collectors: collectors}, nil 103 return &NodeCollector{Collectors: collectors}, nil
104} 104}
105 105
106// Describe implements the prometheus.Collector interface. 106// Describe implements the prometheus.Collector interface.
107func (n nodeCollector) Describe(ch chan<- *prometheus.Desc) { 107func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) {
108 ch <- scrapeDurationDesc 108 ch <- scrapeDurationDesc
109 ch <- scrapeSuccessDesc 109 ch <- scrapeSuccessDesc
110} 110}
111 111
112// Collect implements the prometheus.Collector interface. 112// Collect implements the prometheus.Collector interface.
113func (n nodeCollector) Collect(ch chan<- prometheus.Metric) { 113func (n NodeCollector) Collect(ch chan<- prometheus.Metric) {
114 wg := sync.WaitGroup{} 114 wg := sync.WaitGroup{}
115 wg.Add(len(n.Collectors)) 115 wg.Add(len(n.Collectors))
116 for name, c := range n.Collectors { 116 for name, c := range n.Collectors {