Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2019-11-25 13:39:21 +0300
committerJacob Vosmaer <jacob@gitlab.com>2019-11-25 13:39:21 +0300
commit1ba190ea57e54983fa934b0b01b2302b60e3f2c6 (patch)
treef574b1f459b73f2b3a2662069411d5104a4e2dd1
parentf756ebe2f9b8b12ea2a6922f2833e5edc5055db9 (diff)
Use regular function to count RPC typesjv-use-regular-function
-rw-r--r--internal/middleware/cache/prometheus.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/internal/middleware/cache/prometheus.go b/internal/middleware/cache/prometheus.go
index 949945382..87ae7bfca 100644
--- a/internal/middleware/cache/prometheus.go
+++ b/internal/middleware/cache/prometheus.go
@@ -37,16 +37,17 @@ func init() {
// 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()
+)
+
+func countRPCType(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()
- }
+ switch mInfo.Operation {
+ case protoregistry.OpAccessor:
+ rpcOpTypes.WithLabelValues("accessor").Inc()
+ case protoregistry.OpMutator:
+ rpcOpTypes.WithLabelValues("mutator").Inc()
+ default:
+ rpcOpTypes.WithLabelValues("unknown").Inc()
}
-)
+}