Merge pull request #69 from matthiasr/sort-collector-names

Sort collector names.
This commit is contained in:
Julius Volz 2015-05-13 00:47:05 +02:00
commit 4c6b8ec93b

View File

@ -9,6 +9,7 @@ import (
_ "net/http/pprof"
"os"
"os/signal"
"sort"
"strings"
"sync"
"syscall"
@ -142,8 +143,13 @@ func main() {
flag.Parse()
if *printCollectors {
fmt.Printf("Available collectors:\n")
collectorNames := make(sort.StringSlice, 0, len(collector.Factories))
for n, _ := range collector.Factories {
collectorNames = append(collectorNames, n)
}
collectorNames.Sort()
fmt.Printf("Available collectors:\n")
for _, n := range collectorNames {
fmt.Printf(" - %s\n", n)
}
return