diff --git a/internal/middleware/cache/prometheus.go b/internal/middleware/cache/prometheus.go index 949945382f2ea779fdecc2aec64fcb40cb4cf72a..87ae7bfca9a96be9b8bfac73bfb2785079d304fb 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() } -) +}