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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-04-14 15:17:44 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-04-14 16:00:34 +0300
commit8ebb6de2b9b0a05e9988a0839e27d17ea66802b9 (patch)
tree0fd488e76793e966efd00c13c929b2700fc29209
parente10d70d496cc8892923c2cb2e7cbf6cc1d75ae58 (diff)
prometheus: Use MustRegister to register metrics
There's two code sites where we call `prometheus.Register()` without checking its error return code. Fix this by instead calling `MustRegister()`, which panics in case registration fails.
-rw-r--r--internal/gitaly/service/repository/repack.go2
-rw-r--r--internal/middleware/limithandler/metrics.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/internal/gitaly/service/repository/repack.go b/internal/gitaly/service/repository/repack.go
index 318abc763..dc6776c63 100644
--- a/internal/gitaly/service/repository/repack.go
+++ b/internal/gitaly/service/repository/repack.go
@@ -26,7 +26,7 @@ var (
)
func init() {
- prometheus.Register(repackCounter)
+ prometheus.MustRegister(repackCounter)
}
// log2Threads returns the log-2 number of threads based on the number of
diff --git a/internal/middleware/limithandler/metrics.go b/internal/middleware/limithandler/metrics.go
index f561f2735..f8200180a 100644
--- a/internal/middleware/limithandler/metrics.go
+++ b/internal/middleware/limithandler/metrics.go
@@ -67,7 +67,7 @@ func EnableAcquireTimeHistogram(buckets []float64) {
[]string{"system", "grpc_service", "grpc_method"},
)
- prometheus.Register(histogramVec)
+ prometheus.MustRegister(histogramVec)
}
func (c *promMonitor) Queued(ctx context.Context) {