Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

new(userspace/libsinsp): expose get_owner_last_error in plugin's capture listening capability #2147

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

FedeDP
Copy link
Contributor

@FedeDP FedeDP commented Nov 5, 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:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

new(userspace/libsinsp): expose `get_owner_last_error` in plugin's capture listening capability

…pture listening capability.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
@poiana
Copy link
Contributor

poiana commented Nov 5, 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

@FedeDP
Copy link
Contributor Author

FedeDP commented Nov 5, 2024

/milestone 0.19.0

@poiana poiana added this to the 0.19.0 milestone Nov 5, 2024
@poiana poiana added the size/S label Nov 5, 2024
// Return a string with the error that was last generated by the plugin's
// owner, or NULL if no error is present.
// The string pointer is owned by the plugin's owenr.
const char* (*get_owner_last_error)(ss_plugin_owner_t* o);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed to expose table_reader and table_writer from plugin sdks.

@@ -371,7 +371,10 @@ void sinsp::open_common(scap_open_args* oargs,
// notify registered plugins of capture open
for(auto& p : m_plugin_manager->plugins()) {
if(p->caps() & CAP_CAPTURE_LISTENING) {
p->capture_open();
if(!p->capture_open()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Manage errors in capture_open/close.

@FedeDP
Copy link
Contributor Author

FedeDP commented Nov 5, 2024

/cc @mrgian @jasondellaluce

Copy link

github-actions bot commented Nov 5, 2024

Perf diff from master - unit tests

     3.68%     +0.98%  [.] sinsp_parser::process_event
     7.56%     -0.89%  [.] sinsp::next
     0.45%     +0.71%  [.] libsinsp::state::stl_container_table_adapter<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, libsinsp::state::value_table_entry_adapter<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, libsinsp::state::value_table_entry_adapter<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::dynamic_fields_t>::stl_container_table_adapter
     3.77%     +0.68%  [.] sinsp_evt::load_params
     5.09%     -0.65%  [.] sinsp_evt::get_type
     1.20%     -0.57%  [.] scap_event_encode_params_v
     1.06%     +0.55%  [.] libsinsp::sinsp_suppress::process_event
     4.08%     -0.47%  [.] gzfile_read
     1.26%     -0.45%  [.] 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> >::find
     1.04%     +0.44%  [.] sinsp_filter_check::parse_field_name

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

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.0418         +0.0418           151           157           151           157
BM_sinsp_split_median                                          +0.0415         +0.0416           151           157           151           157
BM_sinsp_split_stddev                                          +0.0595         +0.0589             2             2             2             2
BM_sinsp_split_cv                                              +0.0170         +0.0165             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0418         +0.0418            55            58            55            58
BM_sinsp_concatenate_paths_relative_path_median                +0.0423         +0.0422            55            58            55            58
BM_sinsp_concatenate_paths_relative_path_stddev                +0.3205         +0.3164             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    +0.2675         +0.2636             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0063         +0.0063            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_median                   +0.0042         +0.0042            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_stddev                  +12.7022        +12.6555             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                      +12.6161        +12.5697             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0411         +0.0411            56            58            56            58
BM_sinsp_concatenate_paths_absolute_path_median                +0.0385         +0.0385            56            58            56            58
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.1347         -0.1346             1             0             1             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.1688         -0.1687             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0161         +0.0161           398           404           398           404
BM_sinsp_split_container_image_median                          +0.0185         +0.0185           397           404           397           404
BM_sinsp_split_container_image_stddev                          -0.3006         -0.3003             3             2             3             2
BM_sinsp_split_container_image_cv                              -0.3116         -0.3114             0             0             0             0

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 74.68%. Comparing base (f82c686) to head (ad86638).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/sinsp.cpp 0.00% 6 Missing ⚠️
userspace/libsinsp/plugin.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2147      +/-   ##
==========================================
- Coverage   74.69%   74.68%   -0.02%     
==========================================
  Files         254      254              
  Lines       33502    33508       +6     
  Branches     5746     5753       +7     
==========================================
  Hits        25025    25025              
- Misses       8477     8483       +6     
Flag Coverage Δ
libsinsp 74.68% <0.00%> (-0.02%) ⬇️

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.

@poiana poiana merged commit 41e4444 into master Nov 5, 2024
47 of 49 checks passed
@poiana poiana deleted the new/expose_get_owner_last_error_listening branch November 5, 2024 10:38
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants