Codebase list golang-github-go-kit-kit / fed8020
metrics/pcp: Formatting and comment fixes Peter Bourgon 7 years ago
2 changed file(s) with 17 addition(s) and 24 deletion(s). Raw diff Collapse all Expand all
5454 // influx n custom custom custom
5555 // prometheus n native native native
5656 // circonus 1 native native native
57 // pcp 1 native native native
57 // pcp 1 native native native
5858 //
5959 package metrics
1010 c *speed.PCPClient
1111 }
1212
13 // NewReporter creates a new Reporter instance.
14 // The first parameter is the application name and is used to create
15 // the speed client. Hence it should be a valid speed parameter name and
16 // should not contain spaces or the path separator for your operating system.
13 // NewReporter creates a new Reporter instance. The first parameter is the
14 // application name and is used to create the speed client. Hence it should be a
15 // valid speed parameter name and should not contain spaces or the path
16 // separator for your operating system.
1717 func NewReporter(appname string) (*Reporter, error) {
1818 c, err := speed.NewPCPClient(appname)
1919 if err != nil {
3636 c speed.Counter
3737 }
3838
39 // NewCounter creates a new Counter.
40 //
41 // This requires a name parameter and can optionally take a couple of
42 // description strings, that are used to create the underlying speed.Counter
43 // and are reported by PCP.
39 // NewCounter creates a new Counter. This requires a name parameter and can
40 // optionally take a couple of description strings, that are used to create the
41 // underlying speed.Counter and are reported by PCP.
4442 func (r *Reporter) NewCounter(name string, desc ...string) (*Counter, error) {
4543 c, err := speed.NewPCPCounter(0, name, desc...)
4644 if err != nil {
5452 // With is a no-op.
5553 func (c *Counter) With(labelValues ...string) metrics.Counter { return c }
5654
57 // Add increments Counter.
58 // speed Counters only take int64, so delta is converted to int64 before
59 // observation. speed Gauges can take float64 and `Add(float64)`
60 // is implemented by metrics.Gauge.
55 // Add increments Counter. speed.Counters only take int64, so delta is converted
56 // to int64 before observation.
6157 func (c *Counter) Add(delta float64) { c.c.Inc(int64(delta)) }
6258
6359 // Gauge implements metrics.Gauge via a single dimensional speed.Gauge.
6561 g speed.Gauge
6662 }
6763
68 // NewGauge creates a new Gauge.
69 //
70 // This requires a name parameter, and again, can take a couple of
71 // optional description strings.
64 // NewGauge creates a new Gauge. This requires a name parameter and can
65 // optionally take a couple of description strings, that are used to create the
66 // underlying speed.Gauge and are reported by PCP.
7267 func (r *Reporter) NewGauge(name string, desc ...string) (*Gauge, error) {
7368 g, err := speed.NewPCPGauge(0, name, desc...)
7469 if err != nil {
9388 h speed.Histogram
9489 }
9590
96 // NewHistogram creates a new Histogram.
97 // Minimum observeable value is 0.
98 // Maximum observeable value is 3600000000.
91 // NewHistogram creates a new Histogram. The minimum observeable value is 0. The
92 // maximum observeable value is 3600000000 (3.6e9).
9993 //
100 // The required parameters are a metric name,
101 // the minimum and maximum observable values,
102 // and a metric unit for the units of the observed values.
94 // The required parameters are a metric name, the minimum and maximum observable
95 // values, and a metric unit for the units of the observed values.
10396 //
10497 // Optionally, it can also take a couple of description strings.
10598 func (r *Reporter) NewHistogram(name string, min, max int64, unit speed.MetricUnit, desc ...string) (*Histogram, error) {