Skip to content

Commit 3ea6b5a

Browse files
committed
cmd/geth: list the available metrics if none specified
1 parent d02f07a commit 3ea6b5a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cmd/geth/monitorcmd.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ func monitor(ctx *cli.Context) {
7171
utils.Fatalf("Failed to retrieve system metrics: %v", err)
7272
}
7373
monitored := resolveMetrics(metrics, ctx.Args())
74+
if len(monitored) == 0 {
75+
list := []string{}
76+
for _, metric := range expandMetrics(metrics, "") {
77+
switch {
78+
case strings.HasSuffix(metric, "/0"):
79+
list = append(list, strings.Replace(metric, "/0", "/[0-100]", -1))
80+
case !strings.Contains(metric, "Percentiles"):
81+
list = append(list, metric)
82+
}
83+
}
84+
sort.Strings(list)
85+
utils.Fatalf("No metrics specified.\n\nAvailable:\n - %s", strings.Join(list, "\n - "))
86+
}
7487
sort.Strings(monitored)
7588

7689
// Create and configure the chart UI defaults

0 commit comments

Comments
 (0)