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
Subquery #4831
Subquery #4831
Conversation
* Introduced a new item called 'itemColon' => ':'. The colon present in the metric identifier wont be considered as itemColon. Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@brian-brazil I see 2 potential places to execute subqueries
Am I missing something here? Which one is preferred? (My choice is 1). |
It should be in eval I think. |
While trying to device a solution in Consider this expression
As we are populating all the vector and matrix selectors beforehand, we would ideally like to load up to But as the As there can be more nesting inside subqueries, this this added overhead fine? |
Or I can selectively load for subqueries. |
This is not a problem for local storage. |
* The step of subquery is still not optional, need to be given. * You cannot pass subquery as an argument to a function yet. Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@brian-brazil I am stuck at choosing default step for expressions of the form For range queries I am able to take the interval given with it. But I am not sure what is to be done in the case of an instant query. |
In both cases, use the global evaluation interval. |
I was unable to find out where the global evaluation interval is I believe it is not this Line 268 in b1e779d
|
That is it. |
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@brian-brazil I think this is good for a review now. I will be adding tests in the meanwhile. |
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
These tests are taken from selectors.test and functions.test. The range selector were just converted to subquery to generate these tests. All the converted tests from selectors.test passed, but many from functions.test were failing due to small drift in the result, only the passing ones are in this commit. Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
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.
How will this interact with sample counting and sample slice pooling?
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
@brian-brazil I have added tests for edge data and offsets. The tests for queries that would return a matrix are in Go, rest all are in testdata directory. What more do I need to add? |
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
You've got a test failure. |
The docs also need updating. |
Would the docs go inside |
Yeah, I think that makes most sense. Just before Operators. |
docs/querying/basics.md
Outdated
@@ -169,6 +169,20 @@ The same works for range vectors. This returns the 5-minutes rate that | |||
|
|||
rate(http_requests_total[5m] offset 1w) | |||
|
|||
## Subquery | |||
|
|||
Subquery allows you to run an instant query for a given range and resolution. Like how range vector selector is for vector selector, subquery is for an instant query. The result of a subquery is a matrix. |
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 comparison to range vector selectors is confusing. It'd be instant vector expressions.
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
I have updated the docs and tests (#1227 (comment), #1227 (comment)). I haven't verified the below test - the value is got when
|
docs/querying/examples.md
Outdated
|
||
This is an example of nested subquery. The subquery for the rate uses default resolution. Note that using subqueries unnecessarily is unwise. | ||
|
||
max_over_time(rate(http_requests_total[30s:5s])[10m:]) |
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 isn't a good example, you should use a range vector selector with rate.
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 thought so, will update it.
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.
max_over_time(rate(rate(distance_covered_total[5s])[30s:5s])[10m:])
- does this look sane? Looks like max acceleration over time.
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.
A rate of a rate doesn't make sense, as rate can only be applied to a counter and the output of rate is a gauge. A deriv of a rate would make sense though.
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.
So does max_over_time(deriv(rate(distance_covered_total[5s])[30s:5s])[10m:])
look fine for the doc?
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, that's fine.
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
I feel that it is pretty much done. Anything missing @brian-brazil? |
Thanks! |
Wow, congrats on getting this done! |
this is huge!! congratz!! |
Thanks @brian-brazil for all the patient reviews! |
Fixes #1227
Based on this design doc: https://docs.google.com/document/d/1P_G87zN88YvmMr4iwLWygChMTZhai1L7S_c0awu1CAE/edit
Checklist
Intensive real world tests