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(libscap): use scap_errprintf for scap errors handling #2286

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

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Feb 20, 2025

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:

This PR replaces all custom scap errors handing with the usage of scap_errprintf macro.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@poiana
Copy link
Contributor

poiana commented Feb 20, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ekoops
Once this PR has been reviewed and has the lgtm label, please assign andreagit97 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Please double check driver/API_VERSION file. See versioning.

/hold

@FedeDP
Copy link
Contributor

FedeDP commented Feb 21, 2025

/milestone 0.21.0

@poiana poiana added this to the 0.21.0 milestone Feb 21, 2025
Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.32%. Comparing base (0d94d2b) to head (174aafa).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2286   +/-   ##
=======================================
  Coverage   75.32%   75.32%           
=======================================
  Files         280      280           
  Lines       34556    34556           
  Branches     5902     5902           
=======================================
  Hits        26031    26031           
  Misses       8525     8525           
Flag Coverage Δ
libsinsp 75.32% <ø> (ø)

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.

@ekoops ekoops force-pushed the ekoops/use-scap-errprintf branch 5 times, most recently from 4bbc1ad to 0e1dd26 Compare February 21, 2025 16:33
Copy link

github-actions bot commented Feb 21, 2025

Perf diff from master - unit tests

     3.83%     -0.83%  [.] next_event_from_file
     1.40%     +0.55%  [.] sinsp_parser::process_event
     9.59%     -0.49%  [.] sinsp_thread_manager::create_thread_dependencies
    18.25%     +0.46%  [.] sinsp_threadinfo::get_main_thread
     1.82%     +0.44%  [.] sinsp_thread_manager::get_thread_ref
     0.58%     -0.26%  [.] scap_next
     0.85%     -0.24%  [.] sinsp_evt::get_syscall_return_value
     0.64%     +0.23%  [.] sinsp_evt::get_ts
     0.74%     +0.21%  [.] sinsp_evt_filter::sinsp_evt_filter
     1.49%     -0.21%  [.] 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: -14.45K
peak RSS (including heaptrack overhead): 0B
total memory leaked: -14.45K

Heap diff from master - scap file

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

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.0505         -0.0506           150           143           150           143
BM_sinsp_split_median                                          -0.0519         -0.0520           151           143           151           143
BM_sinsp_split_stddev                                          +0.5028         +0.5031             1             1             1             1
BM_sinsp_split_cv                                              +0.5827         +0.5832             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0634         -0.0635            63            59            63            59
BM_sinsp_concatenate_paths_relative_path_median                -0.0696         -0.0696            63            59            63            58
BM_sinsp_concatenate_paths_relative_path_stddev                -0.4821         -0.4827             1             0             1             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.4471         -0.4476             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0371         +0.0370            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0364         +0.0362            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +1.1408         +1.1539             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +1.0642         +1.0770             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.0366         -0.0367            62            60            62            60
BM_sinsp_concatenate_paths_absolute_path_median                -0.0250         -0.0250            62            61            62            61
BM_sinsp_concatenate_paths_absolute_path_stddev                +3.3203         +3.3154             0             1             0             1
BM_sinsp_concatenate_paths_absolute_path_cv                    +3.4846         +3.4796             0             0             0             0
BM_sinsp_split_container_image_mean                            -0.0095         -0.0095           395           391           395           391
BM_sinsp_split_container_image_median                          -0.0121         -0.0121           396           391           396           391
BM_sinsp_split_container_image_stddev                          -0.4587         -0.4591             4             2             4             2
BM_sinsp_split_container_image_cv                              -0.4535         -0.4539             0             0             0             0

@ekoops ekoops force-pushed the ekoops/use-scap-errprintf branch from 0e1dd26 to 174aafa Compare February 21, 2025 16:53
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.

3 participants