[Test] TSDB: let BenchmarkAddExemplar reuse slots

Test with different amounts of capacity and exemplars, so that sometimes
new exemplars are evicting older exemplars.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2024-05-11 16:43:34 +01:00
parent 6683895620
commit 929fbf860e

View file

@ -415,11 +415,12 @@ func BenchmarkAddExemplar(b *testing.B) {
// before adding.
exLabels := labels.FromStrings("trace_id", "89620921")
for _, capacity := range []int{1000, 10000, 100000} {
for _, n := range []int{10000, 100000, 1000000} {
b.Run(strconv.Itoa(n), func(b *testing.B) {
b.Run(fmt.Sprintf("%d/%d", n, capacity), func(b *testing.B) {
for j := 0; j < b.N; j++ {
b.StopTimer()
exs, err := NewCircularExemplarStorage(int64(n), eMetrics)
exs, err := NewCircularExemplarStorage(int64(capacity), eMetrics)
require.NoError(b, err)
es := exs.(*CircularExemplarStorage)
var l labels.Labels
@ -438,6 +439,7 @@ func BenchmarkAddExemplar(b *testing.B) {
})
}
}
}
func BenchmarkResizeExemplars(b *testing.B) {
testCases := []struct {