Skip to content

Commit

Permalink
node: fill StandardCounters as part of debugapi/metrics (ethereum#16054)
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense authored and karalabe committed Feb 27, 2018
1 parent dd389e5 commit 18bb3da
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions node/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ func (api *PublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error) {
// Fill the counter with the metric details, formatting if requested
if raw {
switch metric := metric.(type) {
case metrics.Counter:
root[name] = map[string]interface{}{
"Overall": float64(metric.Count()),
}

case metrics.Meter:
root[name] = map[string]interface{}{
"AvgRate01Min": metric.Rate1(),
Expand Down Expand Up @@ -338,6 +343,11 @@ func (api *PublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error) {
}
} else {
switch metric := metric.(type) {
case metrics.Counter:
root[name] = map[string]interface{}{
"Overall": float64(metric.Count()),
}

case metrics.Meter:
root[name] = map[string]interface{}{
"Avg01Min": format(metric.Rate1()*60, metric.Rate1()),
Expand Down

0 comments on commit 18bb3da

Please sign in to comment.