Skip to content

Commit 5bd7332

Browse files
committed
add rpc method request gauge
1 parent 894b1e3 commit 5bd7332

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

rpc/handler.go

+1
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ func (h *handler) handleCall(cp *callProc, msg *jsonrpcMessage) *jsonrpcMessage
340340
successfulRequestGauge.Inc(1)
341341
}
342342
rpcServingTimer.UpdateSince(start)
343+
newRPCRequestGauge(msg.Method).Inc(1)
343344
newRPCServingTimer(msg.Method, answer.Error == nil).UpdateSince(start)
344345
}
345346
return answer

rpc/metrics.go

+5
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@ func newRPCServingTimer(method string, valid bool) metrics.Timer {
3737
m := fmt.Sprintf("rpc/duration/%s/%s", method, flag)
3838
return metrics.GetOrRegisterTimer(m, nil)
3939
}
40+
41+
func newRPCRequestGauge(method string) metrics.Gauge {
42+
m := fmt.Sprintf("rpc/count/%s", method)
43+
return metrics.GetOrRegisterGauge(m, nil)
44+
}

0 commit comments

Comments
 (0)