-
Notifications
You must be signed in to change notification settings - Fork 544
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
MQE Absent function #10523
base: main
Are you sure you want to change the base?
MQE Absent function #10523
Conversation
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
innerExpr parser.Expr | ||
inner types.InstantVectorOperator | ||
expressionPosition posrange.PositionRange | ||
absentCount int |
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.
If I'm understanding your intention correctly, would innerSeriesCount
be a clearer name?
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.
This is count how often the series is not there or being absent
. But let me double check again according to the feedback in #10523 (comment) to ensure the correctness.
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 don't think this is correct - I think we're missing a few test cases that might flush out the correct behaviour:
- instant query over a selector that selects multiple series, each with a point at the query time
- instant query over an expression that could produce multiple series, but doesn't have any points (eg.
absent(metric_with_many_series > Inf)
) - range query over a selector that selects a single series that does not have points at every time step in the range
- same as above, but with points at every time step in the range
- range query over a selector that selects multiple series that together don't have points at every time step in the range
- same as above, but where each time step has a sample in at least one series
- range query over an expression that could produce multiple series, but doesn't have any points (eg.
absent(metric_with_many_series > Inf)
)
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.
Thanks for the detailed feedback to ensure the correctness. I will add the test cases to ensure the correct behaviour.
) | ||
|
||
// AbsentOperator is an operator that implements the absent() function. | ||
type AbsentOperator struct { |
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.
[nit] We generally haven't used an Operator
suffix for operators - I think Absent
would be sufficient.
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.
[nit] This probably belongs in the functions
package given it implements a function.
pkg/streamingpromql/functions.go
Outdated
@@ -22,6 +23,7 @@ type InstantVectorFunctionOperatorFactory func( | |||
annotations *annotations.Annotations, | |||
expressionPosition posrange.PositionRange, | |||
timeRange types.QueryTimeRange, | |||
innerExpressions parser.Expressions, |
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.
[nit] Perhaps argumentExpressions
would be a clearer name? Or argExpressions
to maintain symmetry with args
?
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
Signed-off-by: Jon Kartago Lamida <[email protected]>
What this PR does
Implement absent function. Added a new
AbsentOperator
. We also need to modifyInstantVectorFunctionOperatorFactory
to passparser.Expressions
object needed to evaluate the labels of the absent argument.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.