[rpc] Add rate limit data to metrics (#3727)
* Add rate limit to metrics * Compliance with harmony's metrics specifications * Improve rate limit metrics info * minor: remove the redundancy of rpc metrics name Signed-off-by: Leo Chen <leo@harmony.one> * [rpc] set default rate limit to 1000 Signed-off-by: Leo Chen <leo@harmony.one> * [rpc] fix test errors Signed-off-by: Leo Chen <leo@harmony.one> * [metrics] init rpc rate limiter Signed-off-by: Leo Chen <leo@harmony.one> Co-authored-by: Leo Chen <leo@harmony.one>pull/3744/head
parent
99334272e0
commit
e77bd0efe5
@ -0,0 +1,23 @@ |
||||
package rpc |
||||
|
||||
import ( |
||||
prom "github.com/harmony-one/harmony/api/service/prometheus" |
||||
"github.com/prometheus/client_golang/prometheus" |
||||
) |
||||
|
||||
func init() { |
||||
prom.PromRegistry().MustRegister( |
||||
rpcRateLimitCounterVec, |
||||
) |
||||
} |
||||
|
||||
var ( |
||||
rpcRateLimitCounterVec = prometheus.NewCounterVec( |
||||
prometheus.CounterOpts{ |
||||
Namespace: "hmy", |
||||
Subsystem: "rpc", |
||||
Name: "over_ratelimit", |
||||
Help: "number of times triggered rpc rate limit", |
||||
}, |
||||
[]string{"rate_limit"}) |
||||
) |
Loading…
Reference in new issue