Register xfunctions in global parser for rule file loading#7621
Open
PaurushGarg wants to merge 1 commit into
Open
Register xfunctions in global parser for rule file loading#7621PaurushGarg wants to merge 1 commit into
PaurushGarg wants to merge 1 commit into
Conversation
e73662c to
f97c199
Compare
Signed-off-by: Paurush Garg <paurushg@amazon.com>
f97c199 to
e3052e3
Compare
harry671003
approved these changes
Jun 12, 2026
SungJin1212
approved these changes
Jun 12, 2026
SungJin1212
reviewed
Jun 12, 2026
Comment on lines
+667
to
+670
| // Register xfunctions (xincrease, xrate, xdelta) in the global parser | ||
| if t.Cfg.Querier.ThanosEngine.EnableXFunctions { | ||
| maps.Copy(parser.Functions, parse.XFunctions) | ||
| } |
Member
There was a problem hiding this comment.
Suggested change
| // Register xfunctions (xincrease, xrate, xdelta) in the global parser | |
| if t.Cfg.Querier.ThanosEngine.EnableXFunctions { | |
| maps.Copy(parser.Functions, parse.XFunctions) | |
| } | |
| // Register xfunctions (xincrease, xrate, xdelta) in the global parser | |
| if t.Cfg.Querier.ThanosEngine.Enabled && t.Cfg.Querier.ThanosEngine.EnableXFunctions { | |
| maps.Copy(parser.Functions, parse.XFunctions) | |
| } |
nit: should we add an enabled condition?
yeya24
reviewed
Jun 12, 2026
| * [FEATURE] Querier: Add timeout classification to classify query timeouts as 4XX (user error) or 5XX (system error) based on phase timing. When enabled, queries that spend most of their time in PromQL evaluation return `422 Unprocessable Entity` instead of `503 Service Unavailable`. #7374 | ||
| * [FEATURE] Querier: Implement Resource Based Throttling in Querier. #7442 | ||
| * [FEATURE] Querier: Add resource-based query eviction that automatically cancels the heaviest running query when CPU or heap utilization exceeds configured thresholds. #7488 | ||
| * [BUGFIX] Ruler: Register xfunctions (xincrease, xrate, xdelta) in the global parser before loading rule files. #7621 |
Contributor
There was a problem hiding this comment.
This changelog entry needs to be properly sorted
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
When the Thanos engine xfunctions flag is enabled, the ruler's query engine
correctly supports xincrease/xrate/xdelta for evaluating expressions. However,
the rule file loader (rulefmt.ParseFile) uses the global parser.Functions
registry which did not include xfunctions. This caused the ruler to silently
drop recording rules containing xfunctions during S3/disk loading.
Fix: Register xfunctions in parser.Functions at ruler startup when
-querier.enable-x-functions=true, sorulefmt.ParseFilecan parse ruleexpressions that use these functions.
Which issue(s) this PR fixes:
Checklist: