Skip to content

Conversation

charleskorn
Copy link
Contributor

@charleskorn charleskorn commented Aug 30, 2024

What this PR does

This PR extends query-tee's response comparison to accept equivalent but non-identical error messages as the same.

For example, Prometheus' engine and MQE return slightly different error messages in some circumstances, and Prometheus' engine is non-deterministic when selecting example series in some error messages. Both of these situations can cause query-tee to consider a response as different, but we usually don't care as long as the errors are equivalent.

This new behaviour is enabled by default but can be disabled with -proxy.require-exact-error-match=true.

Which issue(s) this PR fixes or relates to

(none)

Checklist

  • Tests updated.
  • [n/a] Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • [n/a] about-versioning.md updated with experimental features.

@charleskorn charleskorn marked this pull request as ready for review August 30, 2024 06:58
@charleskorn charleskorn requested a review from a team as a code owner August 30, 2024 06:58
// Prometheus' engine:
regexp.MustCompile(`invalid parameter "query": invalid expression type "range vector" for range query, must be Scalar or instant Vector`),
// MQE:
regexp.MustCompile(`invalid parameter "query": query expression produces a range vector, but expression for range queries must produce an instant vector or scalar`),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should MQE be changed to be the same for this one? (and later promql can be fixed to be more descriptive)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've intentionally decided to provide clearer error messages where we can in MQE, even if that means diverging from Prometheus' engine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, but I'm wondering if we should be the same to ease testing, and open PRs upstream to fix up wording. Nonetheless, not a blocker here :-)

Copy link
Contributor

@jhesketh jhesketh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but the new flag should probably be added to docs/sources/mimir/manage/tools/query-tee.md too.

@charleskorn
Copy link
Contributor Author

lgtm, but the new flag should probably be added to docs/sources/mimir/manage/tools/query-tee.md too.

Done in 56f9674.

@charleskorn charleskorn merged commit e7706d5 into main Sep 5, 2024
29 checks passed
@charleskorn charleskorn deleted the charleskorn/query-tee-error-equivalence branch September 5, 2024 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants