blob: 195bab26baf9f10d5cc5cf97c43d567ea625c722 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package cache
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"gitlab.com/gitlab-org/gitaly/v14/internal/praefect/protoregistry"
)
var (
rpcTotal = promauto.NewCounter(
prometheus.CounterOpts{
Name: "gitaly_cacheinvalidator_rpc_total",
Help: "Total number of RPCs encountered by cache invalidator",
},
)
rpcOpTypes = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "gitaly_cacheinvalidator_optype_total",
Help: "Total number of operation types encountered by cache invalidator",
},
[]string{"type"},
)
methodErrTotals = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "gitaly_cacheinvalidator_error_total",
Help: "Total number of cache invalidation errors by method",
},
[]string{"method"},
)
)
// counter functions are package vars to allow for overriding in tests
var (
countMethodErr = func(method string) { methodErrTotals.WithLabelValues(method).Inc() }
countRPCType = func(mInfo protoregistry.MethodInfo) {
rpcTotal.Inc()
switch mInfo.Operation {
case protoregistry.OpAccessor:
rpcOpTypes.WithLabelValues("accessor").Inc()
case protoregistry.OpMutator:
rpcOpTypes.WithLabelValues("mutator").Inc()
default:
rpcOpTypes.WithLabelValues("unknown").Inc()
}
}
)
|