Sort collector names.
This makes the `-collectors.print` output easier to read.
This commit is contained in:
parent
b4f40ab13f
commit
57a6701dc9
|
@ -9,6 +9,7 @@ import (
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
@ -142,8 +143,13 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *printCollectors {
|
if *printCollectors {
|
||||||
fmt.Printf("Available collectors:\n")
|
collectorNames := make(sort.StringSlice, 0, len(collector.Factories))
|
||||||
for n, _ := range 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)
|
fmt.Printf(" - %s\n", n)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue