forked from kubevirt/cluster-network-addons-operator
/
counter_vec.go
38 lines (28 loc) · 865 Bytes
/
counter_vec.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
37
38
package operatormetrics
import "github.com/prometheus/client_golang/prometheus"
type CounterVec struct {
prometheus.CounterVec
metricOpts MetricOpts
}
var _ Metric = &CounterVec{}
// NewCounterVec creates a new CounterVec. The CounterVec must be registered
// with the Prometheus registry through RegisterMetrics.
func NewCounterVec(metricOpts MetricOpts, labels []string) *CounterVec {
metricOpts.labels = labels
return &CounterVec{
CounterVec: *prometheus.NewCounterVec(prometheus.CounterOpts(convertOpts(metricOpts)), labels),
metricOpts: metricOpts,
}
}
func (c *CounterVec) GetOpts() MetricOpts {
return c.metricOpts
}
func (c *CounterVec) GetType() MetricType {
return CounterVecType
}
func (c *CounterVec) GetBaseType() MetricType {
return CounterType
}
func (c *CounterVec) getCollector() prometheus.Collector {
return c.CounterVec
}