mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
metrics: use integers for percentiles; remove Overall
This commit is contained in:
parent
d6f6cceabc
commit
8e795c23c1
2 changed files with 7 additions and 6 deletions
|
|
@ -136,14 +136,13 @@ func (exp *exp) publishTimer(name string, metric metrics.Timer) {
|
||||||
|
|
||||||
func (exp *exp) publishResettingTimer(name string, metric metrics.ResettingTimer) {
|
func (exp *exp) publishResettingTimer(name string, metric metrics.ResettingTimer) {
|
||||||
t := metric.Snapshot()
|
t := metric.Snapshot()
|
||||||
ps := t.Percentiles([]float64{0.5, 0.75, 0.95, 0.99, 0.999})
|
ps := t.Percentiles([]float64{50, 75, 95, 99})
|
||||||
exp.getInt(name + ".count").Set(int64(len(t.Values())))
|
exp.getInt(name + ".count").Set(int64(len(t.Values())))
|
||||||
exp.getFloat(name + ".mean").Set(t.Mean())
|
exp.getFloat(name + ".mean").Set(t.Mean())
|
||||||
exp.getInt(name + ".50-percentile").Set(ps[0])
|
exp.getInt(name + ".50-percentile").Set(ps[0])
|
||||||
exp.getInt(name + ".75-percentile").Set(ps[1])
|
exp.getInt(name + ".75-percentile").Set(ps[1])
|
||||||
exp.getInt(name + ".95-percentile").Set(ps[2])
|
exp.getInt(name + ".95-percentile").Set(ps[2])
|
||||||
exp.getInt(name + ".99-percentile").Set(ps[3])
|
exp.getInt(name + ".99-percentile").Set(ps[3])
|
||||||
exp.getInt(name + ".999-percentile").Set(ps[4])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (exp *exp) syncToExpvar() {
|
func (exp *exp) syncToExpvar() {
|
||||||
|
|
|
||||||
10
node/api.go
10
node/api.go
|
|
@ -340,9 +340,10 @@ func (api *PublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error) {
|
||||||
|
|
||||||
case metrics.ResettingTimer:
|
case metrics.ResettingTimer:
|
||||||
t := metric.Snapshot()
|
t := metric.Snapshot()
|
||||||
ps := t.Percentiles([]float64{0.05, 0.2, 0.5, 0.8, 0.95})
|
ps := t.Percentiles([]float64{5, 20, 50, 80, 95})
|
||||||
root[name] = map[string]interface{}{
|
root[name] = map[string]interface{}{
|
||||||
"Overall": format(float64(len(t.Values())), t.Mean()),
|
"Measurements": len(t.Values()),
|
||||||
|
"Mean": time.Duration(t.Mean()).String(),
|
||||||
"Percentiles": map[string]interface{}{
|
"Percentiles": map[string]interface{}{
|
||||||
"5": time.Duration(ps[0]).String(),
|
"5": time.Duration(ps[0]).String(),
|
||||||
"20": time.Duration(ps[1]).String(),
|
"20": time.Duration(ps[1]).String(),
|
||||||
|
|
@ -389,9 +390,10 @@ func (api *PublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error) {
|
||||||
|
|
||||||
case metrics.ResettingTimer:
|
case metrics.ResettingTimer:
|
||||||
t := metric.Snapshot()
|
t := metric.Snapshot()
|
||||||
ps := t.Percentiles([]float64{0.05, 0.2, 0.5, 0.8, 0.95})
|
ps := t.Percentiles([]float64{5, 20, 50, 80, 95})
|
||||||
root[name] = map[string]interface{}{
|
root[name] = map[string]interface{}{
|
||||||
"Overall": format(float64(len(t.Values())), t.Mean()),
|
"Measurements": len(t.Values()),
|
||||||
|
"Mean": time.Duration(t.Mean()).String(),
|
||||||
"Percentiles": map[string]interface{}{
|
"Percentiles": map[string]interface{}{
|
||||||
"5": time.Duration(ps[0]).String(),
|
"5": time.Duration(ps[0]).String(),
|
||||||
"20": time.Duration(ps[1]).String(),
|
"20": time.Duration(ps[1]).String(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue