aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-25 20:33:26 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-25 20:33:26 +0800
commitfdbf8be7356cb8a80c6fdfe0d24b0863903e1832 (patch)
treefc328174dc7a0215bf083f0ad1b67f908ebe9944 /rpc/api
parentc0343c8f17de0b896d4c0546921881a92ce4ae1a (diff)
downloaddexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.tar
dexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.tar.gz
dexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.tar.bz2
dexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.tar.lz
dexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.tar.xz
dexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.tar.zst
dexon-fdbf8be7356cb8a80c6fdfe0d24b0863903e1832.zip
cmd/geth, rpc/api: fix reported metrics issues
Diffstat (limited to 'rpc/api')
-rw-r--r--rpc/api/debug.go27
1 files changed, 12 insertions, 15 deletions
diff --git a/rpc/api/debug.go b/rpc/api/debug.go
index 5975f88ab..f16f62d2e 100644
--- a/rpc/api/debug.go
+++ b/rpc/api/debug.go
@@ -193,11 +193,6 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
format := func(total float64, rate float64) string {
return fmt.Sprintf("%s (%s/s)", round(total, 0), round(rate, 2))
}
- // Create the percentile units
- percentiles := make([]float64, 101)
- for i := 0; i <= 100; i++ {
- percentiles[i] = float64(i) / 100
- }
// Iterate over all the metrics, and just dump for now
counters := make(map[string]interface{})
metrics.DefaultRegistry.Each(func(name string, metric interface{}) {
@@ -220,21 +215,23 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
"AvgRate05Min": metric.Rate5(),
"AvgRate15Min": metric.Rate15(),
"MeanRate": metric.RateMean(),
- "Total": float64(metric.Count()),
+ "Overall": float64(metric.Count()),
}
case metrics.Timer:
- ps := make(map[string]interface{})
- for i, p := range metric.Percentiles(percentiles) {
- ps[fmt.Sprintf("%d", i)] = p
- }
root[name] = map[string]interface{}{
"AvgRate01Min": metric.Rate1(),
"AvgRate05Min": metric.Rate5(),
"AvgRate15Min": metric.Rate15(),
"MeanRate": metric.RateMean(),
- "Total": float64(metric.Count()),
- "Percentiles": ps,
+ "Overall": float64(metric.Count()),
+ "Percentiles": map[string]interface{}{
+ "5": metric.Percentile(0.05),
+ "20": metric.Percentile(0.2),
+ "50": metric.Percentile(0.5),
+ "80": metric.Percentile(0.8),
+ "95": metric.Percentile(0.95),
+ },
}
default:
@@ -247,7 +244,7 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
"Avg01Min": format(metric.Rate1()*60, metric.Rate1()),
"Avg05Min": format(metric.Rate5()*300, metric.Rate5()),
"Avg15Min": format(metric.Rate15()*900, metric.Rate15()),
- "Total": format(float64(metric.Count()), metric.RateMean()),
+ "Overall": format(float64(metric.Count()), metric.RateMean()),
}
case metrics.Timer:
@@ -255,15 +252,15 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) {
"Avg01Min": format(metric.Rate1()*60, metric.Rate1()),
"Avg05Min": format(metric.Rate5()*300, metric.Rate5()),
"Avg15Min": format(metric.Rate15()*900, metric.Rate15()),
- "Total": format(float64(metric.Count()), metric.RateMean()),
+ "Overall": format(float64(metric.Count()), metric.RateMean()),
"Maximum": time.Duration(metric.Max()).String(),
"Minimum": time.Duration(metric.Min()).String(),
"Percentiles": map[string]interface{}{
+ "5": time.Duration(metric.Percentile(0.05)).String(),
"20": time.Duration(metric.Percentile(0.2)).String(),
"50": time.Duration(metric.Percentile(0.5)).String(),
"80": time.Duration(metric.Percentile(0.8)).String(),
"95": time.Duration(metric.Percentile(0.95)).String(),
- "99": time.Duration(metric.Percentile(0.99)).String(),
},
}