diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-06-24 23:30:00 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-06-24 23:34:05 +0800 |
commit | 92ef33d97a437dce2d7b55f06342de388d95f575 (patch) | |
tree | cf184042cb7f4de51c3f11f94bef785eff52bee7 /rpc | |
parent | 302187ae397c5e06a9f086183d55f591f5daf588 (diff) | |
download | dexon-92ef33d97a437dce2d7b55f06342de388d95f575.tar dexon-92ef33d97a437dce2d7b55f06342de388d95f575.tar.gz dexon-92ef33d97a437dce2d7b55f06342de388d95f575.tar.bz2 dexon-92ef33d97a437dce2d7b55f06342de388d95f575.tar.lz dexon-92ef33d97a437dce2d7b55f06342de388d95f575.tar.xz dexon-92ef33d97a437dce2d7b55f06342de388d95f575.tar.zst dexon-92ef33d97a437dce2d7b55f06342de388d95f575.zip |
rpc/api, cmd/geth: retrievel all percentiles, add time units
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/api/debug.go | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/rpc/api/debug.go b/rpc/api/debug.go index 45c99f295..5975f88ab 100644 --- a/rpc/api/debug.go +++ b/rpc/api/debug.go @@ -193,6 +193,11 @@ 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{}) { @@ -211,29 +216,25 @@ func (self *debugApi) Metrics(req *shared.Request) (interface{}, error) { switch metric := metric.(type) { case metrics.Meter: root[name] = map[string]interface{}{ - "Avg01Min": metric.Rate1(), - "Avg05Min": metric.Rate5(), - "Avg15Min": metric.Rate15(), - "AvgTotal": metric.RateMean(), - "Total": float64(metric.Count()), + "AvgRate01Min": metric.Rate1(), + "AvgRate05Min": metric.Rate5(), + "AvgRate15Min": metric.Rate15(), + "MeanRate": metric.RateMean(), + "Total": 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{}{ - "Avg01Min": metric.Rate1(), - "Avg05Min": metric.Rate5(), - "Avg15Min": metric.Rate15(), - "AvgTotal": metric.RateMean(), - "Total": float64(metric.Count()), - "Maximum": metric.Max(), - "Minimum": metric.Min(), - "Percentile": map[string]interface{}{ - "20": metric.Percentile(0.2), - "50": metric.Percentile(0.5), - "80": metric.Percentile(0.8), - "95": metric.Percentile(0.95), - "99": metric.Percentile(0.99), - }, + "AvgRate01Min": metric.Rate1(), + "AvgRate05Min": metric.Rate5(), + "AvgRate15Min": metric.Rate15(), + "MeanRate": metric.RateMean(), + "Total": float64(metric.Count()), + "Percentiles": ps, } default: @@ -254,10 +255,10 @@ 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()), - "Count": format(float64(metric.Count()), metric.RateMean()), + "Total": format(float64(metric.Count()), metric.RateMean()), "Maximum": time.Duration(metric.Max()).String(), "Minimum": time.Duration(metric.Min()).String(), - "Percentile": map[string]interface{}{ + "Percentiles": map[string]interface{}{ "20": time.Duration(metric.Percentile(0.2)).String(), "50": time.Duration(metric.Percentile(0.5)).String(), "80": time.Duration(metric.Percentile(0.8)).String(), |