Codebase list golang-github-go-kit-kit / b9af4aa
metrics: pcp: add support for descriptions Suyash 7 years ago
1 changed file(s) with 18 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1111 }
1212
1313 // 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...)
1620 if err != nil {
1721 panic(err)
1822 }
4347 }
4448
4549 // 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...)
4856 if err != nil {
4957 panic(err)
5058 }
7684 // NewHistogram creates a new Histogram
7785 // minimum observeable value is 0
7886 // 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...)
8193 if err != nil {
8294 panic(err)
8395 }