-
Notifications
You must be signed in to change notification settings - Fork 543
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
query-frontend: correctly replace @
modifier for split queries
#8162
query-frontend: correctly replace @
modifier for split queries
#8162
Conversation
The existing code would only evaluate the at modifier for vector selectors, but subquery expressions also can have it. Signed-off-by: Dimitar Dimitrov <[email protected]>
Signed-off-by: Dimitar Dimitrov <[email protected]>
d791d8a
to
c2ed965
Compare
Signed-off-by: Dimitar Dimitrov <[email protected]>
switch exprAt := n.(type) { | ||
case *parser.VectorSelector: | ||
switch exprAt.StartOrEnd { | ||
case parser.START: | ||
selector.Timestamp = &start | ||
exprAt.Timestamp = &start | ||
case parser.END: | ||
selector.Timestamp = &end | ||
exprAt.Timestamp = &end | ||
} | ||
selector.StartOrEnd = 0 | ||
exprAt.StartOrEnd = 0 | ||
case *parser.SubqueryExpr: | ||
switch exprAt.StartOrEnd { | ||
case parser.START: | ||
exprAt.Timestamp = &start | ||
case parser.END: | ||
exprAt.Timestamp = &end | ||
} | ||
exprAt.StartOrEnd = 0 | ||
} |
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 couldn't find a brief generic way to write this, so the 7 lines are completely duplicated
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.
Great, thanks!
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.
Nice job!
…fana#8162) * query-frontend: correctly replace `@` modifier for split queries The existing code would only evaluate the at modifier for vector selectors, but subquery expressions also can have it. Signed-off-by: Dimitar Dimitrov <[email protected]> * Add CHANGELOG.md entry Signed-off-by: Dimitar Dimitrov <[email protected]> * Rename variable Signed-off-by: Dimitar Dimitrov <[email protected]> --------- Signed-off-by: Dimitar Dimitrov <[email protected]>
What this PR does
The existing code would only evaluate the at modifier for vector selectors, but subquery expressions also can have it. There are no other expression types in promQL which can take the
@
modifiers.Which issue(s) this PR fixes or relates to
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.