aboutsummaryrefslogtreecommitdiffstats
path: root/node/api.go
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2018-02-27 21:30:07 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-02-27 21:30:07 +0800
commit18bb3da55e4d2f6b5e9142b7f5d5bd76f2fb78b0 (patch)
tree7653b97cc63bfb6379d5b22c5f070cc09e91627e /node/api.go
parentdd389e595f3fa1c9644478b4c21a5127e916ec04 (diff)
downloaddexon-18bb3da55e4d2f6b5e9142b7f5d5bd76f2fb78b0.tar.gz
dexon-18bb3da55e4d2f6b5e9142b7f5d5bd76f2fb78b0.tar.zst
dexon-18bb3da55e4d2f6b5e9142b7f5d5bd76f2fb78b0.zip
node: fill StandardCounters as part of debugapi/metrics (#16054)
Diffstat (limited to 'node/api.go')
-rw-r--r--node/api.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/node/api.go b/node/api.go
index 992a7c416..a3b8bc0bb 100644
--- a/node/api.go
+++ b/node/api.go
@@ -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(),
@@ -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()),