...
1 package prometheus
2
3 import (
4 pm "github.com/prometheus/client_golang/prometheus"
5 )
6
7 type GaugeVec struct {
8 collector
9 opts GaugeOpts
10 labelnames []string
11 gv *pm.GaugeVec
12 }
13
14 func (g *GaugeVec) init() *GaugeVec {
15 g.gv = pm.NewGaugeVec(
16 pm.GaugeOpts{
17 Name: g.opts.Name,
18 Help: g.opts.Help,
19 }, g.labelnames)
20 g.setParent(g)
21 return g
22 }
23 func (g *GaugeVec) PMCollector() pm.Collector {
24 return g.gv
25 }
26
27 func (g *GaugeVec) With(l Labels) pm.Gauge {
28 promreg.used(g.opts.Name, l)
29 return g.gv.With(pm.Labels(l))
30 }
31 func (g *GaugeVec) Set(f float64) {
32 g.gv.With(pm.Labels{}).Set(f)
33 }
34 func (g *GaugeVec) Inc() {
35 g.gv.With(pm.Labels{}).Inc()
36 }
37 func (g *GaugeVec) Dec() {
38 g.gv.With(pm.Labels{}).Dec()
39 }
40
View as plain text