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

wip: chore(userspace/libsinsp): move user group manager on container_id changed refresh to a RAII object #2194

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented Dec 9, 2024

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area libsinsp

What this PR does / why we need it:

If a way similar to #2182, move logic to refresh user/group info upon container_id changes to a RAII object instantiated by sinsp::next().
This allows to take into consideration eventual "container_id" changes made by plugin parsers.
While right now there is no need for this, it will be mandatory for the container plugin, since it will be responsible to actually write the container_id state entry for threadinfo.

Also, avoid relying upon container manager on_remove_container callback; instead check if a procexit event was received on container's init pid.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

…anged refresh to a RAII object.

Also, avoid subscribing to container manager "container removed" callback;
instead, use same RAII object to check whether init pid for the container did exit.

Signed-off-by: Federico Di Pierro <[email protected]>
@FedeDP
Copy link
Contributor Author

FedeDP commented Dec 9, 2024

/milestone 0.20.0

@poiana poiana added this to the 0.20.0 milestone Dec 9, 2024
@poiana poiana added the size/L label Dec 9, 2024
@poiana
Copy link
Contributor

poiana commented Dec 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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

Copy link

github-actions bot commented Dec 9, 2024

Perf diff from master - unit tests

     6.72%     +1.52%  [.] sinsp_evt::get_type
    10.18%     +1.36%  [.] sinsp::next
     3.42%     -0.55%  [.] sinsp_thread_manager::find_thread
     2.82%     -0.49%  [.] sinsp_parser::process_event
     0.74%     +0.44%  [.] libsinsp::events::is_unknown_event
     1.74%     -0.43%  [.] sinsp_evt_filter::sinsp_evt_filter
     3.64%     -0.32%  [.] sinsp_evt::load_params
     4.51%     -0.31%  [.] gzfile_read
     2.21%     -0.31%  [.] 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
     0.72%     +0.29%  [.] sinsp_evt::get_param

Heap diff from master - unit tests

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

Heap diff from master - scap file

peak heap memory consumption: -2.73K
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.0242         -0.0242           151           147           151           147
BM_sinsp_split_median                                          -0.0213         -0.0213           150           147           150           147
BM_sinsp_split_stddev                                          -0.8320         -0.8321             2             0             2             0
BM_sinsp_split_cv                                              -0.8278         -0.8280             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0128         +0.0128            61            61            61            61
BM_sinsp_concatenate_paths_relative_path_median                +0.0124         +0.0124            61            61            61            61
BM_sinsp_concatenate_paths_relative_path_stddev                +0.5999         +0.5954             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    +0.5796         +0.5752             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0366         +0.0366            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0324         +0.0324            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +3.4747         +3.4635             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +3.3168         +3.3060             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.0477         -0.0477            67            63            67            63
BM_sinsp_concatenate_paths_absolute_path_median                -0.0515         -0.0515            67            64            67            64
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.4351         -0.4349             1             1             1             1
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.4068         -0.4066             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0040         +0.0040           385           387           385           387
BM_sinsp_split_container_image_median                          +0.0051         +0.0051           385           387           385           387
BM_sinsp_split_container_image_stddev                          -0.2892         -0.2897             2             2             2             2
BM_sinsp_split_container_image_cv                              -0.2920         -0.2925             0             0             0             0

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

Attention: Patch coverage is 79.31034% with 18 lines in your changes missing coverage. Please review.

Project coverage is 75.21%. Comparing base (0b53bd7) to head (e9574f6).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/user.cpp 0.00% 7 Missing ⚠️
userspace/libsinsp/user.h 89.36% 5 Missing ⚠️
userspace/libsinsp/parsers.cpp 50.00% 2 Missing ⚠️
userspace/libsinsp/dumper.cpp 50.00% 1 Missing ⚠️
userspace/libsinsp/event.cpp 0.00% 1 Missing ⚠️
userspace/libsinsp/test/filterchecks/evt.cpp 66.66% 1 Missing ⚠️
userspace/libsinsp/threadinfo.cpp 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2194      +/-   ##
==========================================
+ Coverage   75.20%   75.21%   +0.01%     
==========================================
  Files         259      259              
  Lines       33890    33902      +12     
  Branches     5801     5801              
==========================================
+ Hits        25487    25500      +13     
+ Misses       8403     8402       -1     
Flag Coverage Δ
libsinsp 75.21% <79.31%> (+0.01%) ⬆️

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.

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.

2 participants