From e061dfae88c0dd63ff477a153096a1ba28f69f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Krajcsovits?= Date: Sat, 31 Aug 2024 10:27:18 +0200 Subject: [PATCH] native histogram: use exemplars in concurrency test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: György Krajcsovits --- prometheus/histogram_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/prometheus/histogram_test.go b/prometheus/histogram_test.go index f2fb5bb..c2a14ae 100644 --- a/prometheus/histogram_test.go +++ b/prometheus/histogram_test.go @@ -1049,10 +1049,14 @@ func TestNativeHistogramConcurrency(t *testing.T) { go func(vals []float64) { start.Wait() - for _, v := range vals { + for i, v := range vals { // An observation every 1 to 10 seconds. atomic.AddInt64(&ts, rand.Int63n(10)+1) - his.Observe(v) + if i%2 == 0 { + his.Observe(v) + } else { + his.(ExemplarObserver).ObserveWithExemplar(v, Labels{"foo": "bar"}) + } } end.Done() }(vals)