Skip to content
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-1692: allow KEEP filtering logic #740

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

jotak
Copy link
Member

@jotak jotak commented Oct 16, 2024

Description

  • Allow to define filters for keeping flows. These rules are processed separately as the logic is reverse (first match means it's kept)
  • Allow sampling within these new rules
  • Allow regex checks (pre-compiled; need to check error on preprocess)

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Will this change affect NetObserv / Network Observability operator? If not, you can ignore the rest of this checklist.
  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
    • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
    • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
    • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
    • Standard QE validation, with pre-merge tests unless stated otherwise.
    • Regression tests only (e.g. refactoring with no user-facing change).
    • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Oct 16, 2024

@jotak: This pull request references NETOBSERV-1692 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.18.0" version, but no target version was set.

In response to this:

Description

  • Allow to define filters for keeping flows. These rules are processed separately as the logic is reverse (first match means it's kept)
  • Allow sampling within these new rules
  • Allow regex checks (pre-compiled; need to check error on preprocess)

Dependencies

n/a

Checklist

If you are not familiar with our processes or don't know what to answer in the list below, let us know in a comment: the maintainers will take care of that.

  • Will this change affect NetObserv / Network Observability operator? If not, you can ignore the rest of this checklist.
  • Is this PR backed with a JIRA ticket? If so, make sure it is written as a title prefix (in general, PRs affecting the NetObserv/Network Observability product should be backed with a JIRA ticket - especially if they bring user facing changes).
  • Does this PR require product documentation?
  • If so, make sure the JIRA epic is labelled with "documentation" and provides a description relevant for doc writers, such as use cases or scenarios. Any required step to activate or configure the feature should be documented there, such as new CRD knobs.
  • Does this PR require a product release notes entry?
  • If so, fill in "Release Note Text" in the JIRA.
  • Is there anything else the QE team should know before testing? E.g: configuration changes, environment setup, etc.
  • If so, make sure it is described in the JIRA ticket.
  • QE requirements (check 1 from the list):
  • Standard QE validation, with pre-merge tests unless stated otherwise.
  • Regression tests only (e.g. refactoring with no user-facing change).
  • No QE (e.g. trivial change with high reviewer's confidence, or per agreement with the QE team).

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link

openshift-ci bot commented Oct 16, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jotak. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jotak jotak added the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Oct 16, 2024
Copy link

New image:
quay.io/netobserv/flowlogs-pipeline:bfe17ed

It will expire after two weeks.

To deploy this build, run from the operator repo, assuming the operator is running:

USER=netobserv VERSION=bfe17ed make set-flp-image

Copy link

codecov bot commented Oct 16, 2024

Codecov Report

Attention: Patch coverage is 77.01863% with 37 lines in your changes missing coverage. Please review.

Project coverage is 65.16%. Comparing base (5fba26a) to head (f701321).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/utils/filters/filters.go 74.28% 21 Missing and 6 partials ⚠️
pkg/pipeline/transform/transform_filter.go 85.36% 5 Missing and 1 partial ⚠️
pkg/pipeline/encode/metrics/preprocess.go 70.00% 3 Missing ⚠️
pkg/utils/convert.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #740      +/-   ##
==========================================
+ Coverage   64.95%   65.16%   +0.20%     
==========================================
  Files         110      111       +1     
  Lines        8436     8526      +90     
==========================================
+ Hits         5480     5556      +76     
- Misses       2638     2648      +10     
- Partials      318      322       +4     
Flag Coverage Δ
unittests 65.16% <77.01%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pkg/api/transform_filter.go 86.20% <100.00%> (+40.05%) ⬆️
pkg/utils/convert.go 75.58% <50.00%> (ø)
pkg/pipeline/encode/metrics/preprocess.go 90.56% <70.00%> (+3.52%) ⬆️
pkg/pipeline/transform/transform_filter.go 87.74% <85.36%> (-1.25%) ⬇️
pkg/utils/filters/filters.go 74.28% <74.28%> (ø)

docs/api.md Outdated
@@ -161,6 +161,7 @@ Following is the supported API format for filter transformations:
remove_entry_if_equal: removes the entry if the field value equals specified value
remove_entry_if_not_equal: removes the entry if the field value does not equal specified value
remove_entry_all_satisfied: removes the entry if all of the defined rules are satisfied
keep_entry: keeps the entry if the set of rules are all satisfied
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
keep_entry: keeps the entry if the set of rules are all satisfied
keep_entry_all_satisfied: keeps the entry if the set of rules are all satisfied

For consistency

Copy link
Member Author

@jotak jotak Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used a simpler name because there's only 1 "keep entry" rule, as opposed to "remove entry" where there are a bunch of different ones which need to be distinguished from each other.
And I don't think there's any plan to have more "keep entry" rules later because they can all be expressed within that one.
So .. I don't know, between simplicity or consistency, what to prefer ....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, changed to your suggestion: 417769d

pkg/api/transform_filter.go Outdated Show resolved Hide resolved
pkg/pipeline/transform/transform_filter.go Outdated Show resolved Hide resolved
@jotak jotak force-pushed the allow-keep-filters branch from e8e8a4c to 417769d Compare November 13, 2024 07:49
@github-actions github-actions bot removed the ok-to-test To set manually when a PR is safe to test. Triggers image build on PR. label Nov 13, 2024
@jotak jotak requested a review from jpinsonneau November 13, 2024 10:20
Move prom-encode predicates filtering code to its own package and share
it with "keep_entry" transforms
@openshift-ci openshift-ci bot added the lgtm label Nov 25, 2024
@jotak jotak merged commit 0fa789c into netobserv:main Nov 26, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants