metrics: pcp: add support for descriptions
Suyash
7 years ago
11 | 11 | } |
12 | 12 | |
13 | 13 | // NewCounter creates a new Counter |
14 | func NewCounter(name string) *Counter { | |
15 | c, err := speed.NewPCPCounter(0, name) | |
14 | // | |
15 | // this requires a name parameter | |
16 | // and optionally takes a couple of string directions, which | |
17 | // are directly passed to speed | |
18 | func NewCounter(name string, desc ...string) *Counter { | |
19 | c, err := speed.NewPCPCounter(0, name, desc...) | |
16 | 20 | if err != nil { |
17 | 21 | panic(err) |
18 | 22 | } |
43 | 47 | } |
44 | 48 | |
45 | 49 | // NewGauge creates a new Gauge |
46 | func NewGauge(name string) *Gauge { | |
47 | g, err := speed.NewPCPGauge(0, name) | |
50 | // | |
51 | // this requires a name parameter | |
52 | // and optionally takes a couple of string directions, which | |
53 | // are directly passed to speed | |
54 | func NewGauge(name string, desc ...string) *Gauge { | |
55 | g, err := speed.NewPCPGauge(0, name, desc...) | |
48 | 56 | if err != nil { |
49 | 57 | panic(err) |
50 | 58 | } |
76 | 84 | // NewHistogram creates a new Histogram |
77 | 85 | // minimum observeable value is 0 |
78 | 86 | // maximum observeable value is 3600000000 |
79 | func NewHistogram(name string) *Histogram { | |
80 | h, err := speed.NewPCPHistogram(name, 0, 3600000000, 5) | |
87 | // | |
88 | // this requires a name parameter | |
89 | // and optionally takes a couple of string directions, which | |
90 | // are directly passed to speed | |
91 | func NewHistogram(name string, desc ...string) *Histogram { | |
92 | h, err := speed.NewPCPHistogram(name, 0, 3600000000, 5, desc...) | |
81 | 93 | if err != nil { |
82 | 94 | panic(err) |
83 | 95 | } |