func()

in internal/server/server.go [364:389]


func (s *IndexServer) initMetrics() {
	s.promRegistry = prometheus.NewRegistry()

	// Add go runtime metrics and process collectors.
	s.promRegistry.MustRegister(
		collectors.NewGoCollector(),
		collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}),
	)

	s.metricsRequestsTotal = promauto.With(s.promRegistry).NewCounterVec(
		prometheus.CounterOpts{
			Name: "gitlab_zoekt_indexer_requests_total",
			Help: "Total number of HTTP requests by status code, method, and route.",
		},
		[]string{"method", "route", "code"},
	)
	promauto.With(s.promRegistry).NewGaugeFunc(
		prometheus.GaugeOpts{
			Name: "gitlab_zoekt_indexing_locks",
			Help: "Number of indexing locks currently in progress",
		},
		func() float64 {
			return float64(s.IndexingLock.InProgressCount())
		},
	)
}