Skip to content

Commit

Permalink
Merge pull request #61 from binance-chain/requestGauge
Browse files Browse the repository at this point in the history
[R4R]add rpc method request gauge
  • Loading branch information
unclezoro committed Jan 11, 2021
2 parents 3f3f8d0 + 5bd7332 commit cfeab77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions rpc/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions rpc/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit cfeab77

Please sign in to comment.