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

cleanup(sinsp)!: add set_static_container method #2016

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

Molter73
Copy link
Contributor

@Molter73 Molter73 commented Aug 20, 2024

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area libsinsp

Does this PR require a change in the driver versions?

What this PR does / why we need it:

This change splits configuration of the static container data away from the sinsp constructor and into a separate set_static_container method.

The motivation behind this change is two fold:

  • Configuration of other container engines is handled by a call to set_container_engine_mask() before starting the inspector, the new method is closer to this implementation.
  • Enabling metrics collection should not require adopters to pass in 4 unrelated arguments to the sinsp constructor.

These changes will require some modifications into the Falco main repo, as far as I can tell they should be relatively straight forward.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

cleanup(sinsp): add set_static_container method
cleanup(sinsp)!: remove static container arguments from sinsp constructor

This change splits configuration of the static container data away from
the sinsp constructor and into a separate set_static_container method.

The motivation behind this change is two fold:
- Configuration of other container engines is handled by a call to
  set_container_engine_mask() before starting the inspector, the new
  method is closer to this implementation.
- Enabling metrics collection should not require adopters to pass in 4
  unrelated arguments to the sinsp constructor.

These changes will require some modifications into the Falco main repo,
as far as I can tell they should be relatively straight forward.

Signed-off-by: Mauro Ezequiel Moltrasio <[email protected]>
Copy link

Perf diff from master - unit tests

     3.27%     -1.72%  [.] scap_event_decode_params
     6.00%     +1.36%  [.] sinsp::next
     0.28%     +0.97%  [.] sinsp_evt::is_filtered_out
     1.61%     -0.92%  [.] libsinsp::events::is_unknown_event
     3.38%     +0.86%  [.] gzfile_read
     4.16%     +0.84%  [.] sinsp_parser::process_event
     2.83%     +0.75%  [.] sinsp_thread_manager::find_thread
     2.94%     +0.73%  [.] sinsp_thread_manager::get_thread_ref
     5.11%     -0.63%  [.] sinsp_evt::get_type
     0.89%     -0.59%  [.] libsinsp::runc::match_container_id

Perf diff from master - scap file

    23.40%     -9.88%  [.] sinsp_filter_check::tostring
     3.38%     +8.55%  [.] sinsp_filter_check_event::extract_single
    10.13%     +5.52%  [.] sinsp_evt_formatter::tostring_withformat
    16.75%     -5.19%  [.] sinsp_filter_check::extract_nocache
     9.95%     -3.97%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>
     6.74%     -1.84%  [.] formatted_dump
     3.35%     +1.32%  [.] sinsp_filter_check::get_transformed_field_info
     3.38%     +1.29%  [.] sinsp_filter_check_thread::extract_single
     6.50%     -0.56%  [.] sinsp_thread_manager::get_thread_ref
     3.38%     -0.33%  [.] sinsp_filter_check::get_field_info

Heap diff from master - unit tests

peak heap memory consumption: 0B
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

Copy link

codecov bot commented Aug 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.12%. Comparing base (df21b63) to head (3f730c4).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2016      +/-   ##
==========================================
- Coverage   74.12%   74.12%   -0.01%     
==========================================
  Files         253      253              
  Lines       30805    30801       -4     
  Branches     5415     5403      -12     
==========================================
- Hits        22834    22830       -4     
+ Misses       7967     7947      -20     
- Partials        4       24      +20     
Flag Coverage Δ
libsinsp 74.12% <100.00%> (-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.

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.

Agree with the proposed changes! Thanks for the cleanup :)
/approve

@poiana
Copy link
Contributor

poiana commented Aug 20, 2024

LGTM label has been added.

Git tree hash: eaea7250dd6067f4fd314de72751cea3e50c1c7a

@FedeDP
Copy link
Contributor

FedeDP commented Aug 20, 2024

/milestone 0.18.0

@poiana poiana added this to the 0.18.0 milestone Aug 20, 2024
Copy link
Contributor

@incertum incertum 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 Aug 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, incertum, Molter73

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:
  • OWNERS [FedeDP,Molter73,incertum]

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 fb6cef6 into falcosecurity:master Aug 20, 2024
46 checks passed
@Molter73 Molter73 deleted the set-static-container branch August 21, 2024 10:35
@FedeDP FedeDP changed the title cleanup(sinsp): add set_static_container method cleanup(sinsp)!: add set_static_container method Aug 26, 2024
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.

4 participants