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

fix: reduce number of anypb.New invoke when enriching flows #270

Merged
merged 12 commits into from
Apr 24, 2024
Merged

Conversation

nddq
Copy link
Contributor

@nddq nddq commented Apr 15, 2024

Description

Reducing the number of anypb.New calls by making all the flow enrichment functions that is invoking anypb.New such as AddPacketSize and AddTCPFlags, which we are calling separately, into functions that accept RetinaMetadata struct as an additional param, therefore allowing us to create a single flow's metadata struct, adding data into it, and then calling anypb.New once via AddRetinaMetadata at the end when adding the metadata struct to its flow.

Related Issue

If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request.

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

Please add any relevant screenshots or GIFs to showcase the changes made.

Additional Notes

Add any additional notes or context about the pull request here.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@nddq nddq changed the title fix: reduce number of anypb.New invoke when calling toFlow fix: reduce number of anypb.New invoke when calling toFlow Apr 16, 2024
@nddq nddq self-assigned this Apr 18, 2024
@nddq nddq changed the title fix: reduce number of anypb.New invoke when calling toFlow fix: reduce number of anypb.New invoke when enriching flows Apr 22, 2024
@nddq nddq marked this pull request as ready for review April 22, 2024 19:18
@nddq nddq requested a review from a team as a code owner April 22, 2024 19:18
@nddq nddq marked this pull request as draft April 22, 2024 19:33
@nddq nddq marked this pull request as ready for review April 24, 2024 05:15
@nddq nddq added type/enhancement New feature or request area/plugins labels Apr 24, 2024
pkg/utils/flow_utils.go Outdated Show resolved Hide resolved
@rbtr rbtr added this pull request to the merge queue Apr 24, 2024
Merged via the queue into main with commit b384e3c Apr 24, 2024
22 checks passed
@rbtr rbtr deleted the fix/flowUtils branch April 24, 2024 23:17
nddq added a commit that referenced this pull request May 6, 2024
# Description

Reducing the number of `anypb.New` calls by making all the flow
enrichment functions that is invoking `anypb.New` such as
`AddPacketSize` and `AddTCPFlags`, which we are calling separately, into
functions that accept `RetinaMetadata` struct as an additional param,
therefore allowing us to create a single flow's metadata struct, adding
data into it, and then calling `anypb.New` once via `AddRetinaMetadata`
at the end when adding the metadata struct to its flow.
## Related Issue

If this pull request is related to any issue, please mention it here.
Additionally, make sure that the issue is assigned to you before
submitting this pull request.

## Checklist

- [x] I have read the [contributing
documentation](https://retina.sh/docs/contributing).
- [x] I signed and signed-off the commits (`git commit -S -s ...`). See
[this
documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification)
on signing commits.
- [x] I have correctly attributed the author(s) of the code.
- [x] I have tested the changes locally.
- [x] I have followed the project's style guidelines.
- [x] I have updated the documentation, if necessary.
- [x] I have added tests, if applicable.

## Screenshots (if applicable) or Testing Completed

Please add any relevant screenshots or GIFs to showcase the changes
made.

## Additional Notes

Add any additional notes or context about the pull request here.

---

Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more
information on how to contribute to this project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugins type/enhancement New feature or request
Projects
Status: Done
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants