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-1684 Auto teardown after some time / number of flows / packets #59

Merged
merged 3 commits into from
Jul 10, 2024

Conversation

jpinsonneau
Copy link
Contributor

@jpinsonneau jpinsonneau commented Jul 3, 2024

Description

Auto teardown after some time / number of flows / packets
Also took the opportunity to add log level argument and improve display

oc netobserv flows --max-time=30s --max-bytes=1000000 --log-level=trace --sport=443 --direction=Ingress
Running network-observability-cli as Flow Capture
Log level: trace Duration: 28s Capture size: 116KB
Filters:    sport=443 direction=Ingress
          --log-level: components logs (default: info)
          --max-time: maximum capture time (default: 5m)
          --max-bytes: maximum capture bytes (default: 50000000 = 50MB)

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.

  • 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 Jul 3, 2024

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

@jpinsonneau jpinsonneau marked this pull request as ready for review July 3, 2024 14:32
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

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

Project coverage is 28.53%. Comparing base (cccd05d) to head (8ac4491).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
- Coverage   28.99%   28.53%   -0.47%     
==========================================
  Files           8        8              
  Lines        1045     1076      +31     
==========================================
+ Hits          303      307       +4     
- Misses        720      747      +27     
  Partials       22       22              
Flag Coverage Δ
unittests 28.53% <11.42%> (-0.47%) ⬇️

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

Files Coverage Δ
cmd/root.go 60.60% <100.00%> (+2.54%) ⬆️
cmd/flow_capture.go 32.55% <6.25%> (-1.13%) ⬇️
cmd/packet_capture.go 29.82% <5.88%> (-3.51%) ⬇️

... and 1 file with indirect coverage changes

@msherif1234
Copy link
Contributor

pls update the flows doc with the new commands

@msherif1234
Copy link
Contributor

msherif1234 commented Jul 8, 2024

FYI the example u have in PR description is missing --enable_filter=true as flow filtering not on by default


// terminate capture if max bytes reached
totalBytes = totalBytes + int64(bytes)
if totalBytes > maxBytes {
Copy link
Contributor

Choose a reason for hiding this comment

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

do u need to handle cases where user pass only either maxBytes or maxTime but not both ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if user pass only one of these, the default is used for the other one:

	rootCmd.PersistentFlags().DurationVarP(&maxTime, "maxtime", "", 5*time.Minute, "Maximum capture time")
	rootCmd.PersistentFlags().Int64VarP(&maxBytes, "maxbytes", "", 50000000, "Maximum capture bytes")

Copy link
Contributor

Choose a reason for hiding this comment

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

I was more of thinking I wanted to skip one and use the other for example if I know I am sampling large packets so I wanted to skip maxBytes check and just use maxTime?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm that's right ... maybe I should allow -1 value as no limit ?

It would feel strange that the behavior of one of these two changes according to the other so I feel it's the best option here. WDYT ?

Copy link

github-actions bot commented Jul 9, 2024

New image:
quay.io/netobserv/network-observability-cli:679bb17

It will expire after two weeks.

To use this build, update your commands using:

USER=netobserv VERSION=679bb17 make commands

or download the updated commands.

@Amoghrd
Copy link

Amoghrd commented Jul 9, 2024

/label qe-approved

Copy link

openshift-ci bot commented Jul 9, 2024

@Amoghrd: The label(s) qe-approved cannot be applied, because the repository doesn't have them.

In response to this:

/label qe-approved

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.

@jpinsonneau
Copy link
Contributor Author

pls update the flows doc with the new commands

done in 8ac4491
Thanks for the reminder 😸

@msherif1234
Copy link
Contributor

/lgtm

Copy link

openshift-ci bot commented Jul 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 60a259a into netobserv:main Jul 10, 2024
12 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