prometheus/model/labels
Patrick Oyarzun 84841a4c4e
Fix regexp set matches for literal matchers
I was surprised to find out that posting lookups for `foo=~"(bar|bar)"`
are faster than `foo=~"bar"`. It turns out we introduced a performance
regression in https://github.com/grafana/mimir-prometheus/pull/463.

When we added the `optimizeAlternatingLiterals` function, we subtly
broke one edge case. A regexp matcher which matches a single literal,
like `foo=~"bar"` used to return `bar` from `SetMatches()`, but
currently does not. The implication is that the tsdb will first do a
LabelValues call to get all values for `foo`, then match them against
the regexp `bar`. This PR restores the previous behavior which is able
to directly lookup postings for `foo="bar"` instead.
2024-01-02 13:42:01 -06:00
..
labels.go labels: extract common code between slice and stringlabels 2023-11-17 18:20:03 +00:00
labels_common.go labels: extract common code between slice and stringlabels 2023-11-17 18:20:03 +00:00
labels_stringlabels.go labels: extract common code between slice and stringlabels 2023-11-17 18:20:03 +00:00
labels_test.go ci(lint): enable godot; append dot at the end of comments 2023-10-31 19:53:38 +02:00
matcher.go track-number-of-optimized-regexp-label-matchers - make isRegexOptimized (#481) 2023-04-18 07:24:41 +00:00
matcher_test.go feat: dont compile regex matcher if we know its a literal (#12434) 2023-07-04 15:00:51 +00:00
regexp.go Fix regexp set matches for literal matchers 2024-01-02 13:42:01 -06:00
regexp_test.go Fix regexp set matches for literal matchers 2024-01-02 13:42:01 -06:00
sharding.go labels: add stringlabels version of StableHash 2023-05-02 15:51:17 +01:00
sharding_stringlabels.go mv sharding_string.go sharding_stringlabels.go 2023-05-05 12:53:56 +02:00
sharding_test.go Add TestStableHash 2023-05-04 16:54:39 +02:00
test_utils.go labels: use ScratchBuilder in ReadLabels 2022-12-19 15:22:09 +00:00