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

new(sinsp): implement new PPME_SYSCALL_OPEN event #2153

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Andreagit97
Copy link
Member

What type of PR is this?

/kind feature

Any specific area of the project related to this PR?

/area libscap

/area libsinsp

/area tests

Does this PR require a change in the driver versions?

No

What this PR does / why we need it:

This is the first real PR part of the sys_enter/sys_exit initiative #2068.
The suggestion is to review it commit by commit.
The main scope of the PR is to add the new PPME_SYSCALL_OPEN event with its tests in sinsp unit test framework. Apart from this there are some cleanups on enter/exit logic. The idea is to try to divide the new code from the old one where meaningful, using something like if(is_new_event_version()).
I left some todos that we probably need to address at the end of the work, we can probably cleanup and simplify many flows but at the moment i left them as they are to avoid disruption.

Let me know what you think about this :)

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Copy link

github-actions bot commented Nov 8, 2024

Please double check driver/API_VERSION file. See versioning.

/hold

@Andreagit97 Andreagit97 changed the title Implement open exit new(sinsp): implement new PPME_SYSCALL_OPEN event Nov 8, 2024
Copy link

github-actions bot commented Nov 8, 2024

Perf diff from master - unit tests

     3.21%     +1.13%  [.] sinsp_parser::process_event
     2.27%     -1.02%  [.] scap_event_decode_params
     3.62%     -0.96%  [.] sinsp_thread_manager::find_thread
     2.22%     -0.84%  [.] sinsp::fetch_next_event
     5.48%     +0.82%  [.] sinsp_evt::get_type
     0.67%     +0.68%  [.] sinsp_evt::get_direction
     3.15%     +0.60%  [.] sinsp_evt::load_params
     1.02%     -0.58%  [.] std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libsinsp::state::dynamic_struct::field_info>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, libsinsp::state::dynamic_struct::field_info> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_before_node
     9.87%     +0.41%  [.] sinsp_parser::reset
     1.03%     -0.38%  [.] sinsp_split[abi:cxx11]

Heap diff from master - unit tests

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

Heap diff from master - scap file

peak heap memory consumption: 0B
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.0355         -0.0355           146           141           146           141
BM_sinsp_split_median                                          -0.0366         -0.0366           146           141           146           141
BM_sinsp_split_stddev                                          -0.0889         -0.0890             1             0             1             0
BM_sinsp_split_cv                                              -0.0555         -0.0555             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0174         +0.0174            60            61            60            61
BM_sinsp_concatenate_paths_relative_path_median                +0.0170         +0.0170            60            61            60            61
BM_sinsp_concatenate_paths_relative_path_stddev                -0.0374         -0.0365             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.0539         -0.0530             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0132         -0.0132            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_median                   -0.0144         -0.0143            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.3353         +0.3343             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.3531         +0.3522             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0196         +0.0196            62            63            62            63
BM_sinsp_concatenate_paths_absolute_path_median                +0.0116         +0.0116            62            63            62            63
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.7266         -0.7266             1             0             1             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.7319         -0.7318             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0149         +0.0149           373           378           373           378
BM_sinsp_split_container_image_median                          +0.0121         +0.0121           372           377           372           377
BM_sinsp_split_container_image_stddev                          +0.6167         +0.6164             3             4             3             4
BM_sinsp_split_container_image_cv                              +0.5929         +0.5927             0             0             0             0

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 83.41232% with 35 lines in your changes missing coverage. Please review.

Project coverage is 75.00%. Comparing base (facfcc3) to head (40d9eb6).

Files with missing lines Patch % Lines
userspace/libsinsp/event.cpp 20.00% 16 Missing ⚠️
...ce/libsinsp/test/parsers/new_events/parse_open.cpp 92.50% 6 Missing ⚠️
userspace/libsinsp/sinsp_filtercheck_event.cpp 70.58% 5 Missing ⚠️
userspace/libsinsp/event.h 69.23% 4 Missing ⚠️
userspace/libsinsp/parsers.cpp 92.30% 2 Missing ⚠️
userspace/libsinsp/filter_compare.cpp 66.66% 1 Missing ⚠️
userspace/libsinsp/sinsp_filtercheck.cpp 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2153      +/-   ##
==========================================
+ Coverage   74.77%   75.00%   +0.22%     
==========================================
  Files         254      256       +2     
  Lines       33505    33636     +131     
  Branches     5748     5741       -7     
==========================================
+ Hits        25053    25228     +175     
+ Misses       8452     8408      -44     
Flag Coverage Δ
libsinsp 75.00% <83.41%> (+0.22%) ⬆️

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.

/approve

@poiana
Copy link
Contributor

poiana commented Nov 11, 2024

LGTM label has been added.

Git tree hash: 1cdfe973e48e7bf6fe5fd2621c6214b2c340eeeb

@poiana
Copy link
Contributor

poiana commented Nov 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

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

Andreagit97 and others added 3 commits November 12, 2024 18:06
Signed-off-by: Andrea Terzolo <[email protected]>
Signed-off-by: Andrea Terzolo <[email protected]>
Co-authored-by: Federico Di Pierro <[email protected]>
@poiana
Copy link
Contributor

poiana commented Nov 12, 2024

New changes are detected. LGTM label has been removed.

@Andreagit97
Copy link
Member Author

Just rebased to fix the CI

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