-
Notifications
You must be signed in to change notification settings - Fork 15
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
NETOBSERV-226 Refactor query API and filters management #105
NETOBSERV-226 Refactor query API and filters management #105
Conversation
Skipping CI for Draft Pull Request. |
opening as draft, needs frontend update (wip) and some cleanup |
pkg/handler/flows.go
Outdated
return parsed | ||
} | ||
|
||
// groupFilters creates groups of filters for fetching strategy, that depends on the match all/any param |
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'm not super fan of this groupFilters
function, will try to simplify it
pkg/server/flows_test.go
Outdated
// inputPath: "?filters=" + url.QueryEscape("SrcK8S_Namespace=\"start-namespace*\""), | ||
// outputQueries: []string{ | ||
// `?query={app="netobserv-flowcollector",SrcK8S_Namespace=~"^start-namespace.*"}`, | ||
// }, | ||
// }, { | ||
// inputPath: "?filters=" + url.QueryEscape("SrcK8S_Namespace=\"*end-namespace\""), | ||
// outputQueries: []string{ | ||
// `?query={app="netobserv-flowcollector",SrcK8S_Namespace=~".*end-namespace$"}`, | ||
// }, | ||
// }, { | ||
// inputPath: "?filters=" + url.QueryEscape("SrcK8S_Namespace=\"mid-n*e\""), | ||
// outputQueries: []string{ | ||
// `?query={app="netobserv-flowcollector",SrcK8S_Namespace=~"^mid-n.*e$"}`, | ||
// }, |
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.
@jpinsonneau I'd like to get your opinion on that. At the moment, I've removed this mix of exact-matching/start-matching/end-matching, mostly because I don't really see the point of having these particular matches using the double-quotes (which, to me, really mean exact match). I guess if you need these start/end matches, you can use the partial match without the double-quotes, no? Or am I missing a use case?
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.
sure so as soon as you will find a *
char in the filter you will go for partial match right ?
bd5c3e5
to
eb71fcb
Compare
pkg/handler/flows.go
Outdated
aggStreams = streams | ||
aggregated = r | ||
} else { | ||
aggStreams = append(aggStreams, streams...) |
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 do you plan to remove duplicates here ?
What about the limit ?
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.
good points, it needs dedup, I will work on it.
for limit, either we just throw away results outside of the limit, but but it might be a shame, so another option could be to find some twist in the UI to not present the limit option as something hard-defined, but with a more qualitative wording instead? (e.g 100 => fetch few, 500 => fetch more , 1000 => fetch many more .. or find something better) any idea?
For sure this solution comes with some challenges, but IMO we cannot continue without using loki indexes if we want to scale
eb71fcb
to
8f8aba6
Compare
2443a0a
to
bebd019
Compare
@jpinsonneau this is almost ready, I think it's fine to start reviewing / testing, though there's still a couple of things that I need to do:
I've edited the PR description to add details about what changed / why. |
44dc2d8
to
99551dd
Compare
New image: ["quay.io/netobserv/network-observability-console-plugin:9a460ce"]. It will expire after two weeks. |
a025f97
to
7b1265b
Compare
f267539
to
13e2c0f
Compare
New image: ["quay.io/netobserv/network-observability-console-plugin:2329388"]. It will expire after two weeks. |
@memodi hey, here's the image built from CI |
- Backend http API: more explicit query params to not mix filters with non-filter params - "Match any" rewritten: now runs multiple subqueries in parallel, and aggregate the results. It's a better use of labels (indexes), so should be more performant, and also less complexity in LogQL queries - Refactoring the groups logic to handle a couple of missing cases, like with match all + (Src+Dst) common filters. Still a complex part (but complexity was moved from the query builder to pre-processing of filters) - More separation between CSV-export code/endpoint and flow-fetching code/endpoint - Fixed some mixed up uses of stringLabelFilter / regexLabelFilter (basically: always use regexLabelFilter when regex is involved) - Removed some regex feature within exact match (it seems a bit weird to me to me exact match and regex..., and also simplified code to remove ... but we can add it back if there's really some use cases) - Some utility stuff ... - More tests Add some test, move export handler to own file Remove the filters grouping logic It will be implemented straight from the frontend
- Dissociate Columns vs Filters (we must be able to add new filters without adding new columns) - Adapt to new backend API: filters are now passed as a unique query param - Code quality: avoid super large files, split in more react components, etc. - Moved backend logic of all/any matching to frontend. Defining some of the logic rightly in the filter definition themselves help simplifying the code Fix case with different and-filter on same key Fix k8s resource autocompletion, add tests Also fix k8s name regex being too permissive Fix CSV export Add some missing filters - Owner name - Owner kind (merged with kind) - Host renamed Node IP Add more tests fix conflicts Fix warning in test Warning about state modified outside of 'act' was triggered.
- LogQL fix on json "or" fields - Close autocomplete popup on blur - Avoid unnessary call to setIndicator
There was 2 problems with the algo: - Flow records are {stream selector} * Entry line, that is, each entry line in the results has to be considered individually, and merged for iodentical stream selectors - Labels order in stream selector can vary. They must be compared in a consistent way
@jpinsonneau my last commit should fix the issue that we've seen |
ae47385
to
d8ec2ed
Compare
New image: ["quay.io/netobserv/network-observability-console-plugin:f4047c6"]. It will expire after two weeks. |
/cc @brahaney |
@jotak I tested this and didn't find any issues with it. Except for my this comment and UX discussion doc which can be probably addressed in follow up tasks if you agree, rest LGTM. I'll let @brahaney add qe-approved label based on his test results. |
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.
/qe-approved
Thank you @brahaney @memodi @jpinsonneau ! |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jotak The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes netobserv#105 (comment) wrong "dns-default" appearing when searching for dest name loki
Fixes netobserv#105 (comment) wrong "dns-default" appearing when searching for dest name loki
@jpinsonneau I fixed 2 of the mentioned issues, and created 2 tickets for the others: |
Fixes #105 (comment) wrong "dns-default" appearing when searching for dest name loki
JIRA https://issues.redhat.com/browse/NETOBSERV-226
Backend change:
Frontend change: