From be9d82b66e6c5f9d0e31e3e29ecb3477777687b8 Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Thu, 29 Mar 2018 13:42:44 +0100 Subject: [PATCH] Sort collector names in startup logs (#857) Signed-off-by: Brian Brazil --- node_exporter.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/node_exporter.go b/node_exporter.go index b2884c3..79863b9 100644 --- a/node_exporter.go +++ b/node_exporter.go @@ -17,6 +17,7 @@ import ( "fmt" "net/http" _ "net/http/pprof" + "sort" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -87,7 +88,12 @@ func main() { log.Fatalf("Couldn't create collector: %s", err) } log.Infof("Enabled collectors:") + collectors := []string{} for n := range nc.Collectors { + collectors = append(collectors, n) + } + sort.Strings(collectors) + for _, n := range collectors { log.Infof(" - %s", n) }