-
Notifications
You must be signed in to change notification settings - Fork 825
Querier: Support configuring optimizers and XFunctions #6873
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
Querier: Support configuring optimizers and XFunctions #6873
Conversation
edea965
to
c160724
Compare
9052bee
to
895dd48
Compare
pkg/engine/config.go
Outdated
func (cfg *Config) RegisterFlags(f *flag.FlagSet) { | ||
f.BoolVar(&cfg.EnableThanosEngine, "querier.thanos-engine", false, "Experimental. Use Thanos promql engine https://github.com/thanos-io/promql-engine rather than the Prometheus promql engine.") | ||
f.BoolVar(&cfg.EnableXFunctions, "querier.enable-x-functions", false, "Enable xincrease, xdelta, xrate etc from Thanos engine.") | ||
f.StringVar(&cfg.Optimizers, "querier.optimizers", "default", "Logical plan optimizers. Multiple optimizers can be provided as a comma-separated list. Supported values: "+strings.Join(supportedOptimizers, ", ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can accept a prefix so that the prefix can be either querier or ruler.
<prefix>.thanos-engine.enabled
<prefix>.thanos-engine.enable-x-functions
<prefix>.thanos-engine.optimizers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should also have a small doc talking about what are these optimizers and what they do. For now, can we at least mention in the flag description that, what optimizers are included in default
and what additional optimizers are included in all
? And they cannot be enabled together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the second comment, I am planning to add a String()
function to the Optimizer
interface in thanos engine. This will make it easier to do.
require.Equal(t, 200, res.StatusCode) | ||
|
||
for xFunc := range parse.XFunctions { | ||
result, err := c.Query(fmt.Sprintf(`%s(series_1{job="test"}[1m])`, xFunc), series1Timestamp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit surprised that this test could pass when querying query frontend. I don't see we register those functions there. Only in querier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe because the middlewares are disabled by default.
717b8cd
to
4fcd0ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just 1 small nit on the comment. The refactoring is great! Thanks
"github.com/thanos-io/promql-engine/execution/parse" | ||
) | ||
|
||
var functions = buildFunctions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is initialized first, will it get the functions from EnableExperimentalPromQLFunctions
?
Seems it does as TestCanSupportHoltWintersFunc
is able to pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it works because we call EnableExpermimentalPromQLFunctions when creating a new cortex instance and update the functions map in Prometheus.
The parser
is only initialized later on in the code.
4fcd0ec
to
0e6345c
Compare
Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
0e6345c
to
7f3f280
Compare
…#6873) * Querier: Support configuring optimizers and XFunctions Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com> * Address comments Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com> --------- Signed-off-by: 🌲 Harry 🌊 John 🏔 <johrry@amazon.com>
What this PR does:
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]