From e556def3358c8bf2a034ee8ca346e275d09b0898 Mon Sep 17 00:00:00 2001 From: Billy Keyes Date: Wed, 19 Jul 2023 17:27:36 -0700 Subject: [PATCH] Use uniform sample to fix test flakes --- appmetrics/emitter/prometheus/collector_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/appmetrics/emitter/prometheus/collector_test.go b/appmetrics/emitter/prometheus/collector_test.go index 4045e3d7..f0a4ed3a 100644 --- a/appmetrics/emitter/prometheus/collector_test.go +++ b/appmetrics/emitter/prometheus/collector_test.go @@ -155,11 +155,13 @@ histogram_min 8 r := metrics.NewRegistry() c := NewCollector(r, WithTimerQuantiles([]float64{0.5, 0.9, 0.95, 0.99})) - timer := metrics.NewRegisteredTimer("timer", r) + timer := metrics.NewCustomTimer(metrics.NewHistogram(metrics.NewUniformSample(64)), metrics.NewMeter()) for _, i := range []int64{10, 9, 15, 12, 20, 28, 8, 12, 20, 16, 17, 27, 11, 10, 20, 21, 19, 18, 10, 26} { timer.Update(time.Duration(i) * time.Millisecond) } + _ = r.Register("timer", timer) + expected := ` # HELP timer_max_seconds metrics.Timer # TYPE timer_max_seconds untyped