rpcsrv: remove deprecated RPC counters

This commit is contained in:
Roman Khimov 2023-03-18 10:52:24 +03:00
parent 4671fbb3be
commit 6e27883c10
2 changed files with 1 additions and 25 deletions

View file

@ -50,15 +50,6 @@ Receive* APIs.
Removal of these APIs is scheduled for May 2023 (~0.103.0 release). Removal of these APIs is scheduled for May 2023 (~0.103.0 release).
## Prometheus RPC counters
A number of neogo_${method}_called Prometheus counters are marked as
deprecated since version 0.99.5, neogo_rpc_${method}_time histograms can be
used instead (that also have a counter).
It's not a frequently used thing and it's easy to replace it, so removal of
old counters is scheduled for January-February 2023 (~0.100.X release).
## SecondsPerBlock protocol configuration ## SecondsPerBlock protocol configuration
With 0.100.0 version SecondsPerBlock protocol configuration setting was With 0.100.0 version SecondsPerBlock protocol configuration setting was

View file

@ -1,7 +1,6 @@
package rpcsrv package rpcsrv
import ( import (
"fmt"
"strings" "strings"
"time" "time"
@ -10,7 +9,6 @@ import (
// Metrics used in monitoring service. // Metrics used in monitoring service.
var ( var (
rpcCounter = map[string]prometheus.Counter{}
rpcTimes = map[string]prometheus.Histogram{} rpcTimes = map[string]prometheus.Histogram{}
) )
@ -19,22 +17,9 @@ func addReqTimeMetric(name string, t time.Duration) {
if ok { if ok {
hist.Observe(t.Seconds()) hist.Observe(t.Seconds())
} }
ctr, ok := rpcCounter[name]
if ok {
ctr.Inc()
}
} }
func regCounter(call string) { func regCounter(call string) {
ctr := prometheus.NewCounter(
prometheus.CounterOpts{
Help: fmt.Sprintf("Number of calls to %s rpc endpoint (obsolete, to be removed)", call),
Name: fmt.Sprintf("%s_called", call),
Namespace: "neogo",
},
)
prometheus.MustRegister(ctr)
rpcCounter[call] = ctr
rpcTimes[call] = prometheus.NewHistogram( rpcTimes[call] = prometheus.NewHistogram(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
Help: "RPC " + call + " call handling time", Help: "RPC " + call + " call handling time",