Clean up lint errors

pull/141/head
Tobias Schmidt 2015-10-16 15:17:44 -04:00
parent 388cb5eafe
commit 7e2b65f942
2 changed files with 9 additions and 8 deletions

View File

@ -12,6 +12,7 @@
// limitations under the License. // limitations under the License.
// +build !nosupervisord // +build !nosupervisord
package collector package collector
import ( import (

View File

@ -35,7 +35,7 @@ import (
const subsystem = "exporter" const subsystem = "exporter"
var ( var (
// set at build time // Version of node_exporter. Set at build time.
Version = "0.0.0.dev" Version = "0.0.0.dev"
memProfile = flag.String("debug.memprofile-file", "", "Write memory profile to this file upon receipt of SIGUSR1.") memProfile = flag.String("debug.memprofile-file", "", "Write memory profile to this file upon receipt of SIGUSR1.")
@ -59,23 +59,23 @@ var (
) )
) )
// Implements Collector. // NodeCollector implements the prometheus.Collector interface.
type NodeCollector struct { type NodeCollector struct {
collectors map[string]collector.Collector collectors map[string]collector.Collector
} }
// Implements Collector. // Describe implements the prometheus.Collector interface.
func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) { func (n NodeCollector) Describe(ch chan<- *prometheus.Desc) {
scrapeDurations.Describe(ch) scrapeDurations.Describe(ch)
} }
// Implements Collector. // 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 {
go func(name string, c collector.Collector) { go func(name string, c collector.Collector) {
Execute(name, c, ch) execute(name, c, ch)
wg.Done() wg.Done()
}(name, c) }(name, c)
} }
@ -100,7 +100,7 @@ func (h *basicAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
} }
func Execute(name string, c collector.Collector, ch chan<- prometheus.Metric) { func execute(name string, c collector.Collector, ch chan<- prometheus.Metric) {
begin := time.Now() begin := time.Now()
err := c.Update(ch) err := c.Update(ch)
duration := time.Since(begin) duration := time.Since(begin)
@ -137,7 +137,7 @@ func main() {
if *printCollectors { if *printCollectors {
collectorNames := make(sort.StringSlice, 0, len(collector.Factories)) collectorNames := make(sort.StringSlice, 0, len(collector.Factories))
for n, _ := range collector.Factories { for n := range collector.Factories {
collectorNames = append(collectorNames, n) collectorNames = append(collectorNames, n)
} }
collectorNames.Sort() collectorNames.Sort()
@ -153,7 +153,7 @@ func main() {
} }
log.Infof("Enabled collectors:") log.Infof("Enabled collectors:")
for n, _ := range collectors { for n := range collectors {
log.Infof(" - %s", n) log.Infof(" - %s", n)
} }