forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 1
/
metrics.go
36 lines (27 loc) · 857 Bytes
/
metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package generationnumber
import (
"github.com/prometheus/client_golang/prometheus"
)
// Make this package level because we want several instances of a loader to be able to report metrics
var metrics *genLoaderMetrics
type genLoaderMetrics struct {
cacheGenLoadFailures *prometheus.CounterVec
}
func newGenLoaderMetrics(r prometheus.Registerer) *genLoaderMetrics {
if metrics != nil {
return metrics
}
if r == nil {
return nil
}
cacheGenLoadFailures := prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "loki",
Name: "delete_cache_gen_load_failures_total",
Help: "Total number of failures while loading cache generation number using gen number loader",
}, []string{"source"})
r.MustRegister(cacheGenLoadFailures)
metrics = &genLoaderMetrics{
cacheGenLoadFailures: cacheGenLoadFailures,
}
return metrics
}