7 "github.com/go-kit/kit/metrics/teststat"
10 func TestCounter(t *testing.T) {
11 counter := NewCounter("expvar_counter").With("label values", "not supported").(*Counter)
12 value := func() float64 { f, _ := strconv.ParseFloat(counter.f.String(), 64); return f }
13 if err := teststat.TestCounter(counter, value); err != nil {
18 func TestGauge(t *testing.T) {
19 gauge := NewGauge("expvar_gauge").With("label values", "not supported").(*Gauge)
20 value := func() float64 { f, _ := strconv.ParseFloat(gauge.f.String(), 64); return f }
21 if err := teststat.TestGauge(gauge, value); err != nil {
26 func TestHistogram(t *testing.T) {
27 histogram := NewHistogram("expvar_histogram", 50).With("label values", "not supported").(*Histogram)
28 quantiles := func() (float64, float64, float64, float64) {
29 p50, _ := strconv.ParseFloat(histogram.p50.String(), 64)
30 p90, _ := strconv.ParseFloat(histogram.p90.String(), 64)
31 p95, _ := strconv.ParseFloat(histogram.p95.String(), 64)
32 p99, _ := strconv.ParseFloat(histogram.p99.String(), 64)
33 return p50, p90, p95, p99
35 if err := teststat.TestHistogram(histogram, quantiles, 0.01); err != nil {