diff options
author | Anton Evangelatov <anton.evangelatov@gmail.com> | 2018-06-04 18:05:16 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-06-04 18:05:16 +0800 |
commit | be2aec092d9c24c24b8d22d684ed0d11653c3cfc (patch) | |
tree | 74db6c965c6c0d8c235b92710bdacc8fb95ba309 /node/api.go | |
parent | 143c4341d8a2231deade6d7341c668d609bd3486 (diff) | |
download | go-tangerine-be2aec092d9c24c24b8d22d684ed0d11653c3cfc.tar go-tangerine-be2aec092d9c24c24b8d22d684ed0d11653c3cfc.tar.gz go-tangerine-be2aec092d9c24c24b8d22d684ed0d11653c3cfc.tar.bz2 go-tangerine-be2aec092d9c24c24b8d22d684ed0d11653c3cfc.tar.lz go-tangerine-be2aec092d9c24c24b8d22d684ed0d11653c3cfc.tar.xz go-tangerine-be2aec092d9c24c24b8d22d684ed0d11653c3cfc.tar.zst go-tangerine-be2aec092d9c24c24b8d22d684ed0d11653c3cfc.zip |
metrics: expvar support for ResettingTimer (#16878)
* metrics: expvar support for ResettingTimer
* metrics: use integers for percentiles; remove Overall
* metrics: fix edge-case panic for index-out-of-range
Diffstat (limited to 'node/api.go')
-rw-r--r-- | node/api.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/node/api.go b/node/api.go index da9da5bd7..989d3884a 100644 --- a/node/api.go +++ b/node/api.go @@ -338,6 +338,21 @@ func (api *PublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error) { }, } + case metrics.ResettingTimer: + t := metric.Snapshot() + ps := t.Percentiles([]float64{5, 20, 50, 80, 95}) + root[name] = map[string]interface{}{ + "Measurements": len(t.Values()), + "Mean": time.Duration(t.Mean()).String(), + "Percentiles": map[string]interface{}{ + "5": time.Duration(ps[0]).String(), + "20": time.Duration(ps[1]).String(), + "50": time.Duration(ps[2]).String(), + "80": time.Duration(ps[3]).String(), + "95": time.Duration(ps[4]).String(), + }, + } + default: root[name] = "Unknown metric type" } @@ -373,6 +388,21 @@ func (api *PublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error) { }, } + case metrics.ResettingTimer: + t := metric.Snapshot() + ps := t.Percentiles([]float64{5, 20, 50, 80, 95}) + root[name] = map[string]interface{}{ + "Measurements": len(t.Values()), + "Mean": time.Duration(t.Mean()).String(), + "Percentiles": map[string]interface{}{ + "5": time.Duration(ps[0]).String(), + "20": time.Duration(ps[1]).String(), + "50": time.Duration(ps[2]).String(), + "80": time.Duration(ps[3]).String(), + "95": time.Duration(ps[4]).String(), + }, + } + default: root[name] = "Unknown metric type" } |