Skip to content

Commit 68e6e11

Browse files
committed
lint
Signed-off-by: yeya24 <[email protected]>
1 parent 75635b0 commit 68e6e11

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

pkg/ingester/ingester_test.go

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3963,6 +3963,13 @@ func BenchmarkIngester_QueryStreamChunks_MatcherOptimization(b *testing.B) {
39633963
},
39643964
description: "Metric name with != \"\" matchers",
39653965
},
3966+
"metric name with sparse label": {
3967+
matchers: []*labels.Matcher{
3968+
labels.MustNewMatcher(labels.MatchEqual, model.MetricNameLabel, "test_metric"),
3969+
labels.MustNewMatcher(labels.MatchRegexp, "sparse_label", ".+"),
3970+
},
3971+
description: "Metric name with sparse label matcher",
3972+
},
39663973
"complex matchers": {
39673974
matchers: []*labels.Matcher{
39683975
labels.MustNewMatcher(labels.MatchEqual, model.MetricNameLabel, "test_metric"),
@@ -4001,17 +4008,25 @@ func benchmarkQueryStreamChunksWithMatcherOptimization(b *testing.B, enableMatch
40014008

40024009
ctx := user.InjectOrgID(context.Background(), userID)
40034010

4004-
for s := 0; s < 1000; s++ {
4005-
lbls := labels.FromStrings(
4011+
for s := range 1000 {
4012+
// Create base labels
4013+
labelPairs := []string{
40064014
labels.MetricName, "test_metric",
40074015
"region", fmt.Sprintf("region-%d", s%10),
40084016
"job", fmt.Sprintf("job-%d", s%20),
40094017
"env", fmt.Sprintf("env-%d", s%5),
40104018
"pod", fmt.Sprintf("pod-%d", s%1000),
4011-
)
4019+
}
4020+
4021+
// Add sparse label only for half of the series
4022+
if s%2 == 0 {
4023+
labelPairs = append(labelPairs, "sparse_label", fmt.Sprintf("sparse-%d", s%50))
4024+
}
4025+
4026+
lbls := labels.FromStrings(labelPairs...)
40124027

40134028
samples := make([]cortexpb.Sample, 0, 5)
4014-
for t := 0; t < 5; t++ {
4029+
for t := range 5 {
40154030
samples = append(samples, cortexpb.Sample{
40164031
Value: float64(s + t),
40174032
TimestampMs: int64(s*5 + t),

0 commit comments

Comments
 (0)