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

engine: allow to override opts at query time #501

Merged

Conversation

MichaHoffmann
Copy link
Contributor

This PR allows to override engine settings at query time by providing a custom QueryOption struct that implements the promql.QueryOpts interface and can be provided at runtime.
This prepares eventually overriding more options through this to allow controlling more behavior at query time ( i.e. optimizers, fallback; etc).

@MichaHoffmann MichaHoffmann force-pushed the mhoffmann/allow-to-override-engine-opts-at-query-time branch from fc6c3fe to 52d860e Compare December 15, 2024 16:10
res.LookbackDelta = opts.LookbackDelta()
}
if opts.EnablePerStepStats() {
res.EnablePerStepStats = opts.EnablePerStepStats()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This maybe should be &= but im not sure if original logic was a bug or not!

@MichaHoffmann MichaHoffmann force-pushed the mhoffmann/allow-to-override-engine-opts-at-query-time branch from 52d860e to fc40cf4 Compare December 15, 2024 17:47
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

LGTM

engine/engine.go Show resolved Hide resolved
@fpetkovski
Copy link
Collaborator

Maybe we should first create our own interface, and an adapter for the Prometheus engine. It looks like we are struggling to add features because we are coupled to the Prometheus interface.

@MichaHoffmann
Copy link
Contributor Author

Maybe we should first create our own interface, and an adapter for the Prometheus engine. It looks like we are struggling to add features because we are coupled to the Prometheus interface.

Will do

Signed-off-by: Michael Hoffmann <[email protected]>
@MichaHoffmann MichaHoffmann force-pushed the mhoffmann/allow-to-override-engine-opts-at-query-time branch from c6b4621 to 50340b9 Compare December 16, 2024 09:29
@MichaHoffmann MichaHoffmann merged commit 8a0ffdb into main Dec 16, 2024
7 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.

4 participants