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

refactor(libsinp): refactor filter transformers to use interfaces #2224

Merged
merged 6 commits into from
Jan 9, 2025

Conversation

therealbobo
Copy link
Contributor

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

/kind feature

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area API-version

/area build

/area CI

/area driver-kmod

/area driver-bpf

/area driver-modern-bpf

/area libscap-engine-bpf

/area libscap-engine-gvisor

/area libscap-engine-kmod

/area libscap-engine-modern-bpf

/area libscap-engine-nodriver

/area libscap-engine-noop

/area libscap-engine-source-plugin

/area libscap-engine-savefile

/area libscap

/area libpman

/area libsinsp

/area tests

/area proposals

Does this PR require a change in the driver versions?

/version driver-API-version-major

/version driver-API-version-minor

/version driver-API-version-patch

/version driver-SCHEMA-version-major

/version driver-SCHEMA-version-minor

/version driver-SCHEMA-version-patch

What this PR does / why we need it:

Just a cleanup to enhance the maintainability of the transfomers.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Copy link

github-actions bot commented Jan 7, 2025

Perf diff from master - unit tests

    11.81%     -1.62%  [.] sinsp::next
     7.73%     +1.01%  [.] sinsp_evt::get_type
     4.97%     +0.90%  [.] next_event_from_file
    11.05%     -0.86%  [.] sinsp_parser::reset
     3.23%     +0.77%  [.] gzfile_read
     2.01%     -0.36%  [.] scap_event_decode_params
     1.15%     -0.35%  [.] sinsp_parser::event_cleanup
     1.51%     +0.34%  [.] sinsp_evt_filter::sinsp_evt_filter
     2.91%     -0.33%  [.] sinsp_parser::process_event
     1.78%     +0.30%  [.] std::_Hashtable<long, std::pair<long const, std::shared_ptr<sinsp_threadinfo> >, std::allocator<std::pair<long const, std::shared_ptr<sinsp_threadinfo> > >, std::__detail::_Select1st, std::equal_to<long>, std::hash<long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_find_before_node

Heap diff from master - unit tests

peak heap memory consumption: -1.22K
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

peak heap memory consumption: -1.22K
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Benchmarks diff from master

Comparing gbench_data.json to /root/actions-runner/_work/libs/libs/build/gbench_data.json
Benchmark                                                         Time             CPU      Time Old      Time New       CPU Old       CPU New
----------------------------------------------------------------------------------------------------------------------------------------------
BM_sinsp_split_mean                                            +0.0017         +0.0017           147           147           147           147
BM_sinsp_split_median                                          +0.0054         +0.0053           147           147           146           147
BM_sinsp_split_stddev                                          +1.5466         +1.5487             1             2             1             2
BM_sinsp_split_cv                                              +1.5423         +1.5444             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0153         -0.0153            58            57            58            57
BM_sinsp_concatenate_paths_relative_path_median                -0.0152         -0.0152            58            57            58            57
BM_sinsp_concatenate_paths_relative_path_stddev                -0.1682         -0.1700             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.1553         -0.1571             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0283         +0.0282            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_median                   +0.0286         +0.0286            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.3224         +0.3253             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.2861         +0.2889             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.0001         -0.0001            56            56            56            56
BM_sinsp_concatenate_paths_absolute_path_median                -0.0035         -0.0035            56            56            56            56
BM_sinsp_concatenate_paths_absolute_path_stddev                +1.8443         +1.8508             0             1             0             1
BM_sinsp_concatenate_paths_absolute_path_cv                    +1.8446         +1.8511             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0079         +0.0079           389           392           389           392
BM_sinsp_split_container_image_median                          +0.0053         +0.0053           390           392           390           392
BM_sinsp_split_container_image_stddev                          -0.0950         -0.0952             3             3             3             3
BM_sinsp_split_container_image_cv                              -0.1021         -0.1023             0             0             0             0

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 93.65079% with 12 lines in your changes missing coverage. Please review.

Project coverage is 75.10%. Comparing base (f535e22) to head (4f86dba).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
...lter_transformers/sinsp_filter_transformer_len.cpp 82.97% 8 Missing ⚠️
userspace/libsinsp/sinsp_filter_transformers.h 87.50% 2 Missing ⚠️
...p_filter_transformers/sinsp_filter_transformer.cpp 94.11% 1 Missing ⚠️
..._transformers/sinsp_filter_transformer_storage.cpp 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2224      +/-   ##
==========================================
+ Coverage   75.06%   75.10%   +0.04%     
==========================================
  Files         267      274       +7     
  Lines       34259    34302      +43     
  Branches     5930     5934       +4     
==========================================
+ Hits        25715    25762      +47     
+ Misses       8544     8540       -4     
Flag Coverage Δ
libsinsp 75.10% <93.65%> (+0.04%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

I really like the design; what about splitting the new sinsp_filter_FOO_transformer classes in new files?
It would lead to much better readability.

Also RE naming: i suggest
sinsp_filter_transformer_toupper instead of sinsp_filter_toupper_transformer; it is easier to lookup.

@FedeDP
Copy link
Contributor

FedeDP commented Jan 7, 2025

/milestone 0.20.0

@poiana poiana added this to the 0.20.0 milestone Jan 7, 2025
@therealbobo therealbobo requested a review from FedeDP January 7, 2025 15:49
FedeDP
FedeDP previously approved these changes Jan 8, 2025
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana
Copy link
Contributor

poiana commented Jan 8, 2025

LGTM label has been added.

Git tree hash: 93f9c93317c891c21789435ed9f9e42e6744159d

@poiana poiana added the approved label Jan 8, 2025
@FedeDP
Copy link
Contributor

FedeDP commented Jan 8, 2025

/cc @jasondellaluce @LucaGuerra

@poiana poiana requested a review from LucaGuerra January 8, 2025 10:02
Copy link
Contributor

@FedeDP FedeDP left a comment

Choose a reason for hiding this comment

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

/approve

@poiana poiana added the lgtm label Jan 9, 2025
@poiana
Copy link
Contributor

poiana commented Jan 9, 2025

LGTM label has been added.

Git tree hash: 291034fad4f680d7ffc44427c26a47d18cf2635d

@poiana
Copy link
Contributor

poiana commented Jan 9, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, therealbobo

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

@poiana poiana merged commit bd0bb9b into falcosecurity:master Jan 9, 2025
48 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

4 participants