status-go/_assets/patches/geth/0029-node-api-gauge-metric.patch
Adam Babik 6da469140f
Refactor in-app metrics (#963)
Remove Prometheus and other metric types and use metrics package from go-ethereum.
2018-05-16 17:36:59 +02:00

29 lines
870 B
Diff

diff --git a/node/api.go b/node/api.go
index a3b8bc0b..a151147c 100644
--- a/node/api.go
+++ b/node/api.go
@@ -313,6 +313,11 @@ func (api *PublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error) {
"Overall": float64(metric.Count()),
}
+ case metrics.Gauge:
+ root[name] = map[string]interface{}{
+ "Value": float64(metric.Value()),
+ }
+
case metrics.Meter:
root[name] = map[string]interface{}{
"AvgRate01Min": metric.Rate1(),
@@ -348,6 +353,11 @@ func (api *PublicDebugAPI) Metrics(raw bool) (map[string]interface{}, error) {
"Overall": float64(metric.Count()),
}
+ case metrics.Gauge:
+ root[name] = map[string]interface{}{
+ "Value": float64(metric.Value()),
+ }
+
case metrics.Meter:
root[name] = map[string]interface{}{
"Avg01Min": format(metric.Rate1()*60, metric.Rate1()),