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

Mimir query engine: add HTTP header to force use of Prometheus' engine #8454

Merged
merged 8 commits into from
Jun 21, 2024

Conversation

charleskorn
Copy link
Contributor

@charleskorn charleskorn commented Jun 21, 2024

What this PR does

This PR adds support for forcing the use of Prometheus' engine when the Mimir query engine is enabled by sending the X-Mimir-Force-Prometheus-Engine: true HTTP header with the query request.

The header is only effective if fallback to Prometheus' engine is enabled and fallback is enabled (ie. -querier.enable-promql-engine-fallback=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 force-pushed the charleskorn/fallback-with-http-header branch from c4e5134 to 2de35d1 Compare June 21, 2024 05:05
@charleskorn charleskorn force-pushed the charleskorn/fallback-with-http-header branch from 2de35d1 to d5d5fad Compare June 21, 2024 05:05
@charleskorn charleskorn marked this pull request as ready for review June 21, 2024 05:05
@charleskorn charleskorn requested a review from a team as a code owner June 21, 2024 05:05
@@ -27,6 +27,8 @@ type EngineWithFallback struct {
logger log.Logger
}

var errFallbackForcedByHTTPHeader = NotSupportedError{"fallback forced by HTTP header"}
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit)
I don't know if I like using NotSupportedError here. It's not that the query is necessarily unsupported, but that we aren't going to use the query engine. Maybe we need an error class "MQEError" or something that NotSupportError and Fallback use?

Similarly renaming e.unsupportedQueries to FallbackQueries or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I've dropped the awkward use of NotSupportedError in 28c4bc2.

I've kept unsupportedQueries as-is for now - if it annoys us in the future, we can change it.

pkg/streamingpromql/compat/fallback_header_test.go Outdated Show resolved Hide resolved
@charleskorn charleskorn enabled auto-merge (squash) June 21, 2024 06:27
@charleskorn charleskorn merged commit ff0a43e into main Jun 21, 2024
29 checks passed
@charleskorn charleskorn deleted the charleskorn/fallback-with-http-header branch June 21, 2024 07:06
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