-
Notifications
You must be signed in to change notification settings - Fork 54
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
Adding filter to vector scanner #391
Conversation
Signed-off-by: Harsh Pratap Singh <harshpratapsingh8210@gmail.com>
Signed-off-by: Harsh Pratap Singh <harshpratapsingh8210@gmail.com>
@fpetkovski the
but |
Signed-off-by: Harsh Pratap Singh <harshpratapsingh8210@gmail.com>
labels labels.Labels | ||
signature uint64 | ||
samples *storage.MemoizedSeriesIterator | ||
filterFunc func(model.StepVector) model.StepVector |
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 dont think this is ever populated anywhere right?
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.
There might be some gaps in my understanding (sorry) but I thought, the filterFunc field within the vectorScanner struct is being populated within the Next method of the vectorSelector struct. The Next method creates a new vectorScanner and assigns the filterFunc to it before returning the result. After the filterFunc is assigned within the Next method of the vectorSelector struct, the actual filtering process occurs when iterating through the vectors and applying the filterFunc to each StepVector. When the Next method is called, it returns a slice of model.StepVector instances. Each model.StepVector in the returned slice is processed by the filterFunc that was assigned to the corresponding vectorScanner during its creation. The filterFunc is applied to each model.StepVector to perform the desired filtration based on the defined logic within the filterFunc. Hence I dont understand how is it not getting populated!
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 mean it needs to be instantiated somewhere, right now it is always nil as it is never assigned any filter function. You would need to do that. Thats also what the linter is complaining about!
I think we need to add a "FilterFunc" to Edit: that is probably a lot of information! If you have any questions or i can help somehow, let me know! |
@MichaHoffmann thanks for the guidance! I am kinda noob to PromQL engine, I am trying to solve this just for getting some exposure! |
Fixes #338
Changes
Adding a filtering function to the vector scanner which would take in a step vector and produce a new step vector with filtered samples to optimize the query execution process.
Verification
Added a test case
sum(kube_pod_info == 1)
Tests are passing locally using
make test