diff options
author | Valery Piashchynski <[email protected]> | 2020-11-13 17:43:20 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-13 17:43:20 +0300 |
commit | 9fd0b28d3a6a60b5e08af03bd86bcef042152e1c (patch) | |
tree | 2e925c736eb8cf3b27995db0882d06557432925f /plugins/metrics/rpc.go | |
parent | 99b6012400ab407cfcb04aab833640af565d550d (diff) |
golangci linters warnings fix
Diffstat (limited to 'plugins/metrics/rpc.go')
-rw-r--r-- | plugins/metrics/rpc.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/plugins/metrics/rpc.go b/plugins/metrics/rpc.go index a5be2204..9799db3f 100644 --- a/plugins/metrics/rpc.go +++ b/plugins/metrics/rpc.go @@ -24,12 +24,6 @@ type Metric struct { // Add new metric to the designated collector. func (rpc *rpcServer) Add(m *Metric, ok *bool) error { const op = errors.Op("Add metric") - //defer func() { - // if r, fail := recover().(error); fail { - // err = r - // } - //}() - c, exist := rpc.svc.collectors.Load(m.Name) if !exist { return errors.E(op, errors.Errorf("undefined collector `%s`", m.Name)) @@ -68,12 +62,6 @@ func (rpc *rpcServer) Add(m *Metric, ok *bool) error { // Sub subtract the value from the specific metric (gauge only). func (rpc *rpcServer) Sub(m *Metric, ok *bool) error { const op = errors.Op("Sub metric") - //defer func() { - // if r, fail := recover().(error); fail { - // err = r - // } - //}() - c, exist := rpc.svc.collectors.Load(m.Name) if !exist { return errors.E(op, errors.Errorf("undefined collector `%s`", m.Name)) @@ -105,12 +93,6 @@ func (rpc *rpcServer) Sub(m *Metric, ok *bool) error { // Observe the value (histogram and summary only). func (rpc *rpcServer) Observe(m *Metric, ok *bool) error { const op = errors.Op("Observe metrics") - //defer func() { - // if r, fail := recover().(error); fail { - // err = r - // } - //}() - c, exist := rpc.svc.collectors.Load(m.Name) if !exist { return errors.E(op, errors.Errorf("undefined collector `%s`", m.Name)) @@ -153,14 +135,6 @@ func (rpc *rpcServer) Observe(m *Metric, ok *bool) error { // error func (rpc *rpcServer) Declare(nc *NamedCollector, ok *bool) error { const op = errors.Op("Declare metric") - // MustRegister could panic, so, to return error and not shutdown whole app - // we recover and return error - //defer func() { - // if r, fail := recover().(error); fail { - // err = r - // } - //}() - _, exist := rpc.svc.collectors.Load(nc.Name) if exist { return errors.E(op, errors.Errorf("tried to register existing collector with the name `%s`", nc.Name)) @@ -224,7 +198,6 @@ func (rpc *rpcServer) Declare(nc *NamedCollector, ok *bool) error { default: return errors.E(op, errors.Errorf("unknown collector type `%s`", nc.Type)) - } // add collector to sync.Map |