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
path: root/auth
diff options
context:
space:
mode:
authorSashi Kumar <ksashikumark93@gmail.com>2020-05-29 00:22:15 +0300
committerToon Claes <toon@gitlab.com>2021-04-21 16:24:25 +0300
commit811f4e966ae097b50e53c6444ea0aafeb4215999 (patch)
treec811e8fb49d61bc48369a3995d509a3bc85339d8 /auth
parent184ea413f75659a68be2d964b2fb12e512e448ea (diff)
Use promauto to register Prometheus metrics
Diffstat (limited to 'auth')
-rw-r--r--auth/token.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/auth/token.go b/auth/token.go
index 566557f9c..034be2a86 100644
--- a/auth/token.go
+++ b/auth/token.go
@@ -12,6 +12,7 @@ import (
grpc_auth "github.com/grpc-ecosystem/go-grpc-middleware/auth"
"github.com/prometheus/client_golang/prometheus"
+ "github.com/prometheus/client_golang/prometheus/promauto"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
@@ -27,7 +28,7 @@ var (
errUnauthenticated = status.Errorf(codes.Unauthenticated, "authentication required")
errDenied = status.Errorf(codes.PermissionDenied, "permission denied")
- authErrors = prometheus.NewCounterVec(
+ authErrors = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "gitaly_authentication_errors_total",
Help: "Counts of of Gitaly request authentication errors",
@@ -48,10 +49,6 @@ func SetTokenValidityDuration(d time.Duration) {
tokenValidityDuration = d
}
-func init() {
- prometheus.MustRegister(authErrors)
-}
-
// AuthInfo contains the authentication information coming from a request
type AuthInfo struct {
Version string