Codebase list golang-github-go-kit-kit / 56f89df
metrics/pcp: add unit to histogram Suyash 7 years ago
2 changed file(s) with 10 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
9494 // minimum observeable value is 0.
9595 // maximum observeable value is 3600000000.
9696 //
97 // this requires a name parameter, and again, can take a couple of optional description strings.
98 func (r *Reporter) NewHistogram(name string, min, max int64, desc ...string) (*Histogram, error) {
99 h, err := speed.NewPCPHistogram(name, min, max, 5, desc...)
97 // The required parameters are a metric name,
98 // the minimum and maximum observable values,
99 // and a metric unit for the units of the observed values.
100 //
101 // Optionally, it can also take a couple of description strings.
102 func (r *Reporter) NewHistogram(name string, min, max int64, unit speed.MetricUnit, desc ...string) (*Histogram, error) {
103 h, err := speed.NewPCPHistogram(name, min, max, 5, unit, desc...)
100104 if err != nil {
101105 return nil, err
102106 }
11
22 import (
33 "testing"
4
5 "github.com/performancecopilot/speed"
46
57 "github.com/go-kit/kit/metrics/teststat"
68 )
4951 t.Fatal(err)
5052 }
5153
52 histogram, err := r.NewHistogram("speed_histogram", 0, 3600000000)
54 histogram, err := r.NewHistogram("speed_histogram", 0, 3600000000, speed.OneUnit)
5355 if err != nil {
5456 t.Fatal(err)
5557 }