Skip to content

NETOBSERV-2187: Implement DSL based on goyacc, replacing keep_entry API #930

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jotak
Copy link
Member

@jotak jotak commented Apr 22, 2025

Description

The previous keep_entry API is replaced with a small/simple query language that uses goyacc.
This query language currently recognizes:

  • Logical boolean operators
    • and
    • or
  • Comparison operators
    • equals =
    • not equals !=
    • matches regexp =~
    • not matches regexp !~
    • greater than (or equal) > / >=
    • less than (or equal) < / <=
  • Unary operations
    • field is present: with(field)
    • field is absent: without(field)
  • Parenthesis-based priority

Breaking change

Previously, the API would require complex nested yaml to represent filters. It's now replaced with a single string somewhat similar to SQL.

For instance, this old API:

    transform:
      type: filter
      filter:
        rules:
        - type: keep_entry_all_satisfied
          keepEntryAllSatisfied:
          - type: keep_entry_if_equal
            keep_entry:
                input: namespace
                value: "A"
          - type: keep_entry_if_exists
            keep_entry:
                input: workload
        - type: keep_entry_all_satisfied
          keepEntryAllSatisfied:
          - type: keep_entry_if_regex_match
            keep_entry:
                input: service
                value: "abc.+"

... is now simplified to:

    transform:
      type: filter
      filter:
        rules:
        - type: keep_entry_query
          keepEntryQuery: (namespace="A" and with(workload)) or service=~"abc.+"

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).

Copy link

openshift-ci bot commented Apr 22, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

openshift-ci bot commented Apr 22, 2025

[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 assign oliviercazade for approval. For more information see the 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

Copy link

codecov bot commented Apr 22, 2025

Codecov Report

Attention: Patch coverage is 71.02804% with 31 lines in your changes missing coverage. Please review.

Project coverage is 65.33%. Comparing base (bd55b45) to head (6d9e1f5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/dsl/lexer.go 65.38% 20 Missing and 7 partials ⚠️
pkg/pipeline/transform/transform_filter.go 71.42% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #930      +/-   ##
==========================================
+ Coverage   65.20%   65.33%   +0.13%     
==========================================
  Files         117      119       +2     
  Lines        8647     8700      +53     
==========================================
+ Hits         5638     5684      +46     
- Misses       2681     2685       +4     
- Partials      328      331       +3     
Flag Coverage Δ
unittests 65.33% <71.02%> (+0.13%) ⬆️

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 84.61% <ø> (-1.60%) ⬇️
pkg/dsl/eval.go 100.00% <100.00%> (ø)
pkg/utils/filters/filters.go 90.27% <ø> (+15.99%) ⬆️
pkg/pipeline/transform/transform_filter.go 87.41% <71.42%> (-0.33%) ⬇️
pkg/dsl/lexer.go 65.38% <65.38%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jotak jotak added the breaking-change This pull request has breaking changes. They should be described in PR description. label Apr 22, 2025
@jotak jotak changed the title Implement DSL based on goyacc NETOBSERV-2187: Implement DSL based on goyacc, replacing keep_entry API Apr 22, 2025
@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Apr 22, 2025

@jotak: This pull request references NETOBSERV-2187 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.19.0" version, but no target version was set.

In response to this:

Description

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.

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Apr 22, 2025

@jotak: This pull request references NETOBSERV-2187 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.19.0" version, but no target version was set.

In response to this:

Description

The previous keep_entry API is replaced with a small/simple query language that uses goyacc.
This query language currently recognizes logical boolean operations (and/or), string comparisons (equals/not equals/regexp/not regexp) and presence/absence.

Breaking change

Previously, the API would require complex nested yaml to represent filters. It's now replaced with a single string somewhat similar to SQL.

For instance, this old API:

   transform:
     type: filter
     filter:
       rules:
       - type: keep_entry_all_satisfied
         keepEntryAllSatisfied:
         - type: keep_entry_if_equal
           keep_entry:
               input: namespace
               value: "A"
         - type: keep_entry_if_exists
           keep_entry:
               input: workload
       - type: keep_entry_all_satisfied
         keepEntryAllSatisfied:
         - type: keep_entry_if_regex_match
           keep_entry:
               input: service
               value: "abc.+"

... is now simplified to:

   transform:
     type: filter
     filter:
       rules:
       - type: keep_entry_query
         keepEntryQuery: (namespace="A" and with(workload)) or service=~"abc.+"

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.

@jotak jotak marked this pull request as ready for review April 22, 2025 16:09
@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Apr 22, 2025

@jotak: This pull request references NETOBSERV-2187 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.19.0" version, but no target version was set.

In response to this:

Description

The previous keep_entry API is replaced with a small/simple query language that uses goyacc.
This query language currently recognizes:

  • Logical boolean operators
  • and
  • or
  • String comparison operators
  • equals =
  • not equals !=
  • matches regexp =~
  • not matches regexp !~
  • Unary operations
  • field is present: with(field)
  • field is absent: without(field)
  • Parenthesis-based priority

Breaking change

Previously, the API would require complex nested yaml to represent filters. It's now replaced with a single string somewhat similar to SQL.

For instance, this old API:

   transform:
     type: filter
     filter:
       rules:
       - type: keep_entry_all_satisfied
         keepEntryAllSatisfied:
         - type: keep_entry_if_equal
           keep_entry:
               input: namespace
               value: "A"
         - type: keep_entry_if_exists
           keep_entry:
               input: workload
       - type: keep_entry_all_satisfied
         keepEntryAllSatisfied:
         - type: keep_entry_if_regex_match
           keep_entry:
               input: service
               value: "abc.+"

... is now simplified to:

   transform:
     type: filter
     filter:
       rules:
       - type: keep_entry_query
         keepEntryQuery: (namespace="A" and with(workload)) or service=~"abc.+"

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.

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Apr 22, 2025

@jotak: This pull request references NETOBSERV-2187 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.19.0" version, but no target version was set.

In response to this:

Description

The previous keep_entry API is replaced with a small/simple query language that uses goyacc.
This query language currently recognizes:

  • Logical boolean operators
  • and
  • or
  • String comparison operators
  • equals =
  • not equals !=
  • matches regexp =~
  • not matches regexp !~
  • Unary operations
  • field is present: with(field)
  • field is absent: without(field)
  • Parenthesis-based priority

Breaking change

Previously, the API would require complex nested yaml to represent filters. It's now replaced with a single string somewhat similar to SQL.

For instance, this old API:

   transform:
     type: filter
     filter:
       rules:
       - type: keep_entry_all_satisfied
         keepEntryAllSatisfied:
         - type: keep_entry_if_equal
           keep_entry:
               input: namespace
               value: "A"
         - type: keep_entry_if_exists
           keep_entry:
               input: workload
       - type: keep_entry_all_satisfied
         keepEntryAllSatisfied:
         - type: keep_entry_if_regex_match
           keep_entry:
               input: service
               value: "abc.+"

... is now simplified to:

   transform:
     type: filter
     filter:
       rules:
       - type: keep_entry_query
         keepEntryQuery: (namespace="A" and with(workload)) or service=~"abc.+"

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.

jotak added a commit to jotak/network-observability-operator that referenced this pull request Apr 22, 2025
jotak added a commit to jotak/network-observability-operator that referenced this pull request Apr 23, 2025
jotak added a commit to jotak/network-observability-operator that referenced this pull request Apr 23, 2025
@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Apr 23, 2025

@jotak: This pull request references NETOBSERV-2187 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.19.0" version, but no target version was set.

In response to this:

Description

The previous keep_entry API is replaced with a small/simple query language that uses goyacc.
This query language currently recognizes:

  • Logical boolean operators
  • and
  • or
  • Comparison operators
  • equals =
  • not equals !=
  • matches regexp =~
  • not matches regexp !~
  • greater than (or equal) > / >=
  • less than (or equal) < / <=
  • Unary operations
  • field is present: with(field)
  • field is absent: without(field)
  • Parenthesis-based priority

Breaking change

Previously, the API would require complex nested yaml to represent filters. It's now replaced with a single string somewhat similar to SQL.

For instance, this old API:

   transform:
     type: filter
     filter:
       rules:
       - type: keep_entry_all_satisfied
         keepEntryAllSatisfied:
         - type: keep_entry_if_equal
           keep_entry:
               input: namespace
               value: "A"
         - type: keep_entry_if_exists
           keep_entry:
               input: workload
       - type: keep_entry_all_satisfied
         keepEntryAllSatisfied:
         - type: keep_entry_if_regex_match
           keep_entry:
               input: service
               value: "abc.+"

... is now simplified to:

   transform:
     type: filter
     filter:
       rules:
       - type: keep_entry_query
         keepEntryQuery: (namespace="A" and with(workload)) or service=~"abc.+"

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.

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

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

It will expire after two weeks.

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

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

Copy link

openshift-ci bot commented Apr 23, 2025

@jotak: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/qe-e2e-tests 655106a link false /test qe-e2e-tests

Full PR test history. Your PR dashboard.

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 kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This pull request has breaking changes. They should be described in PR description. jira/valid-reference ok-to-test To set manually when a PR is safe to test. Triggers image build on PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants