Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQE: Add tests for various mixed data and edge cases #9281

Merged
merged 23 commits into from
Sep 20, 2024

Conversation

jhesketh
Copy link
Contributor

@jhesketh jhesketh commented Sep 12, 2024

What this PR does

Which issue(s) this PR fixes or relates to

Fixes #

Checklist

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

@jhesketh jhesketh requested a review from a team as a code owner September 12, 2024 06:39
@jhesketh jhesketh changed the title Jhesketh/mqe aggregations tests MQE: Add tests for various mixed data and edge cases Sep 12, 2024
@jhesketh
Copy link
Contributor Author

FYI this test seems expensive (it runs a lot of permutations), but it only takes < 5s on my laptop. We can reduce some of the cases if it grows too much as we add more operations/functions etc.

Copy link
Contributor

@charleskorn charleskorn left a comment

Choose a reason for hiding this comment

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

Nice idea, thanks for putting this together!

pkg/streamingpromql/query.go Outdated Show resolved Hide resolved
pkg/streamingpromql/testing.go Outdated Show resolved Hide resolved
pkg/streamingpromql/testing.go Outdated Show resolved Hide resolved
pkg/streamingpromql/testing.go Outdated Show resolved Hide resolved
pkg/streamingpromql/engine_test.go Show resolved Hide resolved
pkg/streamingpromql/engine_test.go Outdated Show resolved Hide resolved
@charleskorn
Copy link
Contributor

FYI this test seems expensive (it runs a lot of permutations), but it only takes < 5s on my laptop. We can reduce some of the cases if it grows too much as we add more operations/functions etc.

We could also look at running tests in parallel as well, if need be.

But I think 5s is fine for now.

@jhesketh
Copy link
Contributor Author

This uncovered a difference in annotation handling. I looked at making MQE return the same results, but handling it was messy and I think it's easier to fix in Prometheus: prometheus/prometheus#14910

@jhesketh jhesketh force-pushed the jhesketh/mqe-aggregations-tests branch from f5de3f4 to 54a52b3 Compare September 17, 2024 09:01
@jhesketh
Copy link
Contributor Author

prometheus/prometheus#14910 has merged, but it may be a while before prometheus is vendored back into mimir. Until then this PR temporarily doesn't compare annotations.

pkg/streamingpromql/types/metric_names.go Outdated Show resolved Hide resolved
pkg/streamingpromql/engine_test.go Show resolved Hide resolved
mimirResults := q.Exec(context.Background())

// We currently omit checking the annotations due to a difference between the engines.
// This can be re-enabled once https://github.com/prometheus/prometheus/pull/14910 is vendored.
Copy link
Contributor

Choose a reason for hiding this comment

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

As mentioned offline - given prometheus/prometheus#14910 has been merged, could we cherry-pick it into mimir-prometheus and then vendor that into Mimir so we don't need these workarounds without needing to do the pending Prometheus 3.0 merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lets deal with this separately as I think it's a bigger and more complicated task and we have a way forward here for now.

pkg/streamingpromql/engine_test.go Outdated Show resolved Hide resolved
pkg/streamingpromql/engine_test.go Outdated Show resolved Hide resolved
pkg/streamingpromql/engine_test.go Outdated Show resolved Hide resolved
pkg/streamingpromql/query.go Outdated Show resolved Hide resolved
pkg/streamingpromql/query.go Outdated Show resolved Hide resolved
pkg/streamingpromql/testing.go Outdated Show resolved Hide resolved
Copy link
Contributor

@charleskorn charleskorn left a comment

Choose a reason for hiding this comment

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

🚀

@jhesketh jhesketh enabled auto-merge (squash) September 20, 2024 01:08
@jhesketh jhesketh force-pushed the jhesketh/mqe-aggregations-tests branch from 8012108 to 1b4497a Compare September 20, 2024 01:24
@jhesketh jhesketh merged commit aa08b49 into grafana:main Sep 20, 2024
29 checks passed
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