aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/debug_args.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-06-24 19:38:58 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-06-24 23:34:05 +0800
commite5b820c47b9343d3801e1ebbeb4a8f40843ea87c (patch)
tree8c8785f014ed8033fd26129cd553c9635631fb50 /rpc/api/debug_args.go
parentbde2ff034317db977354e0855e6406f9428899ea (diff)
downloadgo-tangerine-e5b820c47b9343d3801e1ebbeb4a8f40843ea87c.tar
go-tangerine-e5b820c47b9343d3801e1ebbeb4a8f40843ea87c.tar.gz
go-tangerine-e5b820c47b9343d3801e1ebbeb4a8f40843ea87c.tar.bz2
go-tangerine-e5b820c47b9343d3801e1ebbeb4a8f40843ea87c.tar.lz
go-tangerine-e5b820c47b9343d3801e1ebbeb4a8f40843ea87c.tar.xz
go-tangerine-e5b820c47b9343d3801e1ebbeb4a8f40843ea87c.tar.zst
go-tangerine-e5b820c47b9343d3801e1ebbeb4a8f40843ea87c.zip
cmd/geth, rpc/api: extend metrics API, add a basic monitor command
Diffstat (limited to 'rpc/api/debug_args.go')
-rw-r--r--rpc/api/debug_args.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/rpc/api/debug_args.go b/rpc/api/debug_args.go
index b9b5aa27e..b72fb03ae 100644
--- a/rpc/api/debug_args.go
+++ b/rpc/api/debug_args.go
@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"math/big"
+ "reflect"
"github.com/ethereum/go-ethereum/rpc/shared"
)
@@ -45,3 +46,26 @@ func (args *WaitForBlockArgs) UnmarshalJSON(b []byte) (err error) {
return nil
}
+
+type MetricsArgs struct {
+ Raw bool
+}
+
+func (args *MetricsArgs) UnmarshalJSON(b []byte) (err error) {
+ var obj []interface{}
+ if err := json.Unmarshal(b, &obj); err != nil {
+ return shared.NewDecodeParamError(err.Error())
+ }
+ if len(obj) > 1 {
+ return fmt.Errorf("metricsArgs needs 0, 1 arguments")
+ }
+ // default values when not provided
+ if len(obj) >= 1 && obj[0] != nil {
+ if value, ok := obj[0].(bool); !ok {
+ return fmt.Errorf("invalid argument %v", reflect.TypeOf(obj[0]))
+ } else {
+ args.Raw = value
+ }
+ }
+ return nil
+}