LabelValues() with matchers should use cache

When cache was introduced, LabelValues() could never be called with
"concurrent" flag so it didn't make sense to use the cached call through
the Head. However, since the introduction of forced cache, we should use
it, as even with concurrent=false the cache may be used.

Signed-off-by: Oleg Zaytsev <mail@olegzaytsev.com>
This commit is contained in:
Oleg Zaytsev 2023-09-27 18:33:18 +02:00
parent 320f0c9c4a
commit 664c125d87
No known key found for this signature in database
GPG key ID: 7E9FE9FD48F512EF

View file

@ -380,7 +380,7 @@ func inversePostingsForMatcher(ctx context.Context, ix IndexPostingsReader, m *l
const maxExpandedPostingsFactor = 100 // Division factor for maximum number of matched series.
func labelValuesWithMatchers(ctx context.Context, r IndexReader, name string, matchers ...*labels.Matcher) ([]string, error) {
p, err := PostingsForMatchers(ctx, r, matchers...)
p, err := r.PostingsForMatchers(ctx, false, matchers...)
if err != nil {
return nil, errors.Wrap(err, "fetching postings for matchers")
}