diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-06-25 20:33:26 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-06-25 20:33:26 +0800 |
commit | fdbf8be7356cb8a80c6fdfe0d24b0863903e1832 (patch) | |
tree | fc328174dc7a0215bf083f0ad1b67f908ebe9944 /cmd/geth/monitorcmd.go | |
parent | c0343c8f17de0b896d4c0546921881a92ce4ae1a (diff) | |
download | dexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.tar.gz dexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.tar.zst dexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.zip |
cmd/geth, rpc/api: fix reported metrics issues
Diffstat (limited to 'cmd/geth/monitorcmd.go')
-rw-r--r-- | cmd/geth/monitorcmd.go | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/cmd/geth/monitorcmd.go b/cmd/geth/monitorcmd.go index 78b67c17c..43937dcaa 100644 --- a/cmd/geth/monitorcmd.go +++ b/cmd/geth/monitorcmd.go @@ -4,6 +4,7 @@ import ( "fmt" "math" "reflect" + "runtime" "sort" "strings" "time" @@ -72,15 +73,7 @@ func monitor(ctx *cli.Context) { } monitored := resolveMetrics(metrics, ctx.Args()) if len(monitored) == 0 { - list := []string{} - for _, metric := range expandMetrics(metrics, "") { - switch { - case strings.HasSuffix(metric, "/0"): - list = append(list, strings.Replace(metric, "/0", "/[0-100]", -1)) - case !strings.Contains(metric, "Percentiles"): - list = append(list, metric) - } - } + list := expandMetrics(metrics, "") sort.Strings(list) utils.Fatalf("No metrics specified.\n\nAvailable:\n - %s", strings.Join(list, "\n - ")) } @@ -116,11 +109,14 @@ func monitor(ctx *cli.Context) { } for i, metric := range monitored { charts[i] = termui.NewLineChart() + if runtime.GOOS == "windows" { + charts[i].Mode = "dot" + } charts[i].Data = make([]float64, 512) charts[i].DataLabels = []string{""} charts[i].Height = (termui.TermHeight() - footer.Height) / rows charts[i].AxesColor = termui.ColorWhite - charts[i].PaddingBottom = -1 + charts[i].PaddingBottom = -2 charts[i].Border.Label = metric charts[i].Border.LabelFgColor = charts[i].Border.FgColor | termui.AttrBold @@ -141,7 +137,7 @@ func monitor(ctx *cli.Context) { for { select { case event := <-termui.EventCh(): - if event.Type == termui.EventKey && event.Ch == 'q' { + if event.Type == termui.EventKey && event.Key == termui.KeyCtrlC { return } if event.Type == termui.EventResize { @@ -302,7 +298,7 @@ func updateChart(metric string, data []float64, chart *termui.LineChart, err err func updateFooter(ctx *cli.Context, err error, footer *termui.Par) { // Generate the basic footer refresh := time.Duration(ctx.Int(monitorCommandRefreshFlag.Name)) * time.Second - footer.Text = fmt.Sprintf("Press q to quit. Refresh interval: %v.", refresh) + footer.Text = fmt.Sprintf("Press Ctrl+C to quit. Refresh interval: %v.", refresh) footer.TextFgColor = termui.Theme().ParTextFg | termui.AttrBold // Append any encountered errors |