Skip to content

Commit 2bd9d6b

Browse files
authored
Merge branch 'google:master' into master
2 parents d593fc1 + fc23546 commit 2bd9d6b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cmd/cadvisor.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"os"
2424
"os/signal"
2525
"runtime"
26+
"sort"
2627
"strings"
2728
"syscall"
2829
"time"
@@ -124,10 +125,11 @@ type metricSetValue struct {
124125
}
125126

126127
func (ml *metricSetValue) String() string {
127-
var values []string
128+
values := make([]string, 0, len(ml.MetricSet))
128129
for metric := range ml.MetricSet {
129130
values = append(values, string(metric))
130131
}
132+
sort.Strings(values)
131133
return strings.Join(values, ",")
132134
}
133135

@@ -147,7 +149,12 @@ func (ml *metricSetValue) Set(value string) error {
147149
}
148150

149151
func init() {
150-
flag.Var(&ignoreMetrics, "disable_metrics", "comma-separated list of `metrics` to be disabled. Options are 'accelerator', 'cpu_topology','disk', 'diskIO', 'memory_numa', 'network', 'tcp', 'udp', 'percpu', 'sched', 'process', 'hugetlb', 'referenced_memory', 'resctrl', 'cpuset'.")
152+
opts := make([]string, 0, len(ignoreWhitelist))
153+
for key := range ignoreWhitelist {
154+
opts = append(opts, string(key))
155+
}
156+
sort.Strings(opts)
157+
flag.Var(&ignoreMetrics, "disable_metrics", fmt.Sprintf("comma-separated list of `metrics` to be disabled. Options are '%s'.", strings.Join(opts, "', '")))
151158

152159
// Default logging verbosity to V(2)
153160
flag.Set("v", "2")

0 commit comments

Comments
 (0)