rpc/server: register ws calls in Prometheus

They were completely missing.
This commit is contained in:
Roman Khimov 2022-03-21 23:18:00 +03:00
parent 13999252c6
commit 0a338ea94b

View file

@ -16,16 +16,23 @@ func incCounter(name string) {
} }
} }
func regCounter(call string) {
ctr := prometheus.NewCounter(
prometheus.CounterOpts{
Help: fmt.Sprintf("Number of calls to %s rpc endpoint", call),
Name: fmt.Sprintf("%s_called", call),
Namespace: "neogo",
},
)
prometheus.MustRegister(ctr)
rpcCounter[call] = ctr
}
func init() { func init() {
for call := range rpcHandlers { for call := range rpcHandlers {
ctr := prometheus.NewCounter( regCounter(call)
prometheus.CounterOpts{ }
Help: fmt.Sprintf("Number of calls to %s rpc endpoint", call), for call := range rpcWsHandlers {
Name: fmt.Sprintf("%s_called", call), regCounter(call)
Namespace: "neogo",
},
)
prometheus.MustRegister(ctr)
rpcCounter[call] = ctr
} }
} }