thanos: Incorrect regex label match when using `|` with an empty option

Thanos, Prometheus and Golang version used: Thanos: v0.22.0 Prometheus: v2.28.1

Object Storage Provider: S3

What happened: Using a Thanos Store Gateway as the data source, prometheus_build_info{doesnotexist=~"whocares|"} (note the tailing | on that regex) returns no series.

What you expected to happen: I expected the Store Gateway to return the same series as prometheus_build_info{doesnotexist=""}, which is what a Prometheus data source does.

How to reproduce it (as minimally and precisely as possible): Write a query with label=~"value|" on a metric without a series with label="value". Use Store Filtering in the Query UI to select either a Prometheus instance or a Store Gateway. Example query: prometheus_build_info{doesnotexist=~"whocares|"}

Full logs to relevant components: Not applicable, I don’t think.

Anything else we need to know: Basically Prometheus appears to interpret {label=~"value|"} as either {label=value} or {label=""} (label does not exist). I expected Thanos to do the same.

Let me know if you need anymore info.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (6 by maintainers)

Most upvoted comments

I suppose a good start would be to add failing tests. A suitable location seems to be the e2e tests: https://github.com/thanos-io/thanos/tree/main/test/e2e.