diff options
author | Tobias Schmidt <ts@soundcloud.com> | 2015-10-16 15:17:44 -0400 |
---|---|---|
committer | Tobias Schmidt <ts@soundcloud.com> | 2015-10-16 18:53:44 -0400 |
commit | 7e2b65f9428e81744941830fab276f12a4e0a5ce (patch) | |
tree | 2f31c48d707be37b856d257b7b78f065fd68e877 /node_exporter.go | |
parent | 388cb5eafeb2e414996532e0a4879b5d701e1101 (diff) | |
download | prometheus_node_collector-7e2b65f9428e81744941830fab276f12a4e0a5ce.tar.bz2 prometheus_node_collector-7e2b65f9428e81744941830fab276f12a4e0a5ce.tar.xz prometheus_node_collector-7e2b65f9428e81744941830fab276f12a4e0a5ce.zip |
Clean up lint errors
Diffstat (limited to 'node_exporter.go')
-rw-r--r-- | node_exporter.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/node_exporter.go b/node_exporter.go index 0765642..4704f94 100644 --- a/node_exporter.go +++ b/node_exporter.go | |||
@@ -35,7 +35,7 @@ import ( | |||
35 | const subsystem = "exporter" | 35 | const subsystem = "exporter" |
36 | 36 | ||
37 | var ( | 37 | var ( |
38 | // set at build time | 38 | // Version of node_exporter. Set at build time. |
39 | Version = "0.0.0.dev" | 39 | Version = "0.0.0.dev" |
40 | 40 | ||
41 | memProfile = flag.String("debug.memprofile-file", "", "Write memory profile to this file upon receipt of SIGUSR1.") | 41 | memProfile = flag.String("debug.memprofile-file", "", "Write memory profile to this file upon receipt of SIGUSR1.") |
@@ -59,23 +59,23 @@ var ( | |||
59 | ) | 59 | ) |
60 | ) | 60 | ) |
61 | 61 | ||
62 | // Implements Collector. | 62 | // NodeCollector implements the prometheus.Collector interface. |
63 | type NodeCollector struct { | 63 | type NodeCollector struct { |
64 | collectors map[string]collector.Collector | 64 | collectors map[string]collector.Collector |
65 | } | 65 | } |
66 | 66 | ||
67 | // Implements Collector. | 67 | // Describe implements the prometheus.Collector interface. |
68 | func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) { | 68 | func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) { |
69 | scrapeDurations.Describe(ch) | 69 | scrapeDurations.Describe(ch) |
70 | } | 70 | } |
71 | 71 | ||
72 | // Implements Collector. | 72 | // Collect implements the prometheus.Collector interface. |
73 | func (n NodeCollector) Collect(ch chan<- prometheus.Metric) { | 73 | func (n NodeCollector) Collect(ch chan<- prometheus.Metric) { |
74 | wg := sync.WaitGroup{} | 74 | wg := sync.WaitGroup{} |
75 | wg.Add(len(n.collectors)) | 75 | wg.Add(len(n.collectors)) |
76 | for name, c := range n.collectors { | 76 | for name, c := range n.collectors { |
77 | go func(name string, c collector.Collector) { | 77 | go func(name string, c collector.Collector) { |
78 | Execute(name, c, ch) | 78 | execute(name, c, ch) |
79 | wg.Done() | 79 | wg.Done() |
80 | }(name, c) | 80 | }(name, c) |
81 | } | 81 | } |
@@ -100,7 +100,7 @@ func (h *basicAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |||
100 | return | 100 | return |
101 | } | 101 | } |
102 | 102 | ||
103 | func Execute(name string, c collector.Collector, ch chan<- prometheus.Metric) { | 103 | func execute(name string, c collector.Collector, ch chan<- prometheus.Metric) { |
104 | begin := time.Now() | 104 | begin := time.Now() |
105 | err := c.Update(ch) | 105 | err := c.Update(ch) |
106 | duration := time.Since(begin) | 106 | duration := time.Since(begin) |
@@ -137,7 +137,7 @@ func main() { | |||
137 | 137 | ||
138 | if *printCollectors { | 138 | if *printCollectors { |
139 | collectorNames := make(sort.StringSlice, 0, len(collector.Factories)) | 139 | collectorNames := make(sort.StringSlice, 0, len(collector.Factories)) |
140 | for n, _ := range collector.Factories { | 140 | for n := range collector.Factories { |
141 | collectorNames = append(collectorNames, n) | 141 | collectorNames = append(collectorNames, n) |
142 | } | 142 | } |
143 | collectorNames.Sort() | 143 | collectorNames.Sort() |
@@ -153,7 +153,7 @@ func main() { | |||
153 | } | 153 | } |
154 | 154 | ||
155 | log.Infof("Enabled collectors:") | 155 | log.Infof("Enabled collectors:") |
156 | for n, _ := range collectors { | 156 | for n := range collectors { |
157 | log.Infof(" - %s", n) | 157 | log.Infof(" - %s", n) |
158 | } | 158 | } |
159 | 159 | ||