feat: slow threshold customizable in zrpc (#1191)

* feat: slow threshold customizable in rest

* feat: slow threshold customizable in rest

* feat: slow threshold customizable in rest

* feat: slow threshold customizable in zrpc
This commit is contained in:
Kevin Wan
2021-11-01 15:04:38 +08:00
committed by GitHub
parent ebc90720ea
commit ba43214dae
9 changed files with 50 additions and 4 deletions

View File

@@ -95,6 +95,11 @@ func (rs *RpcServer) Stop() {
logx.Close()
}
// SetServerSlowThreshold sets the slow threshold on server side.
func SetServerSlowThreshold(threshold time.Duration) {
serverinterceptors.SetSlowThreshold(threshold)
}
func setupInterceptors(server internal.Server, c RpcServerConf, metrics *stat.Metrics) error {
if c.CpuThreshold > 0 {
shedder := load.NewAdaptiveShedder(load.WithCpuThreshold(c.CpuThreshold))