add rpc method request gauge

This commit is contained in:
fudongbai 2021-01-10 22:01:20 +08:00
parent 894b1e3c8d
commit 5bd73320ba
2 changed files with 6 additions and 0 deletions

View File

@ -340,6 +340,7 @@ func (h *handler) handleCall(cp *callProc, msg *jsonrpcMessage) *jsonrpcMessage
successfulRequestGauge.Inc(1)
}
rpcServingTimer.UpdateSince(start)
newRPCRequestGauge(msg.Method).Inc(1)
newRPCServingTimer(msg.Method, answer.Error == nil).UpdateSince(start)
}
return answer

View File

@ -37,3 +37,8 @@ func newRPCServingTimer(method string, valid bool) metrics.Timer {
m := fmt.Sprintf("rpc/duration/%s/%s", method, flag)
return metrics.GetOrRegisterTimer(m, nil)
}
func newRPCRequestGauge(method string) metrics.Gauge {
m := fmt.Sprintf("rpc/count/%s", method)
return metrics.GetOrRegisterGauge(m, nil)
}