forked from kubevirt/cluster-network-addons-operator
/
gauge_vec.go
38 lines (28 loc) · 829 Bytes
/
gauge_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 GaugeVec struct {
prometheus.GaugeVec
metricOpts MetricOpts
}
var _ Metric = &GaugeVec{}
// NewGaugeVec creates a new GaugeVec. The GaugeVec must be registered
// with the Prometheus registry through RegisterMetrics.
func NewGaugeVec(metricOpts MetricOpts, labels []string) *GaugeVec {
metricOpts.labels = labels
return &GaugeVec{
GaugeVec: *prometheus.NewGaugeVec(prometheus.GaugeOpts(convertOpts(metricOpts)), labels),
metricOpts: metricOpts,
}
}
func (c *GaugeVec) GetOpts() MetricOpts {
return c.metricOpts
}
func (c *GaugeVec) GetType() MetricType {
return GaugeVecType
}
func (c *GaugeVec) GetBaseType() MetricType {
return GaugeType
}
func (c *GaugeVec) getCollector() prometheus.Collector {
return c.GaugeVec
}