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 77.03%. Comparing base (c1e6254) to head (7a87905).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2286   +/-   ##
=======================================
  Coverage   77.03%   77.03%           
=======================================
  Files         221      221           
  Lines       30127    30127           
  Branches     4613     4613           
=======================================
  Hits        23207    23207           
  Misses       6920     6920           
Flag Coverage Δ
libsinsp 77.03% <ø> (ø)

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

     6.29%     -0.59%  [.] sinsp::next
     2.04%     +0.53%  [.] sinsp_thread_manager::find_thread
     1.01%     -0.40%  [.] sinsp_parser::event_cleanup
     6.48%     -0.33%  [.] sinsp_parser::reset
     0.92%     +0.32%  [.] sinsp::fetch_next_event
     0.25%     +0.31%  [.] std::_Hashtable<unsigned long, std::pair<unsigned long const, std::shared_ptr<ppm_evt_hdr> >, std::allocator<std::pair<unsigned long const, std::shared_ptr<ppm_evt_hdr> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::find
     9.16%     +0.28%  [.] sinsp_thread_manager::create_thread_dependencies
     1.98%     +0.27%  [.] sinsp_parser::process_event
     0.85%     -0.24%  [.] sinsp_evt::get_direction
     2.50%     -0.23%  [.] sinsp_evt::load_params

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.0637         +0.0636           141           150           141           150
BM_sinsp_split_median                                          +0.0626         +0.0625           141           150           141           150
BM_sinsp_split_stddev                                          -0.7641         -0.7647             1             0             1             0
BM_sinsp_split_cv                                              -0.7782         -0.7788             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  +0.0741         +0.0740            54            58            54            58
BM_sinsp_concatenate_paths_relative_path_median                +0.0785         +0.0784            53            58            53            58
BM_sinsp_concatenate_paths_relative_path_stddev                -0.0460         -0.0454             1             1             1             1
BM_sinsp_concatenate_paths_relative_path_cv                    -0.1118         -0.1111             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0473         +0.0472            23            25            23            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0456         +0.0454            23            25            23            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.1574         +0.1559             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.1051         +0.1038             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.1266         +0.1265            52            59            52            59
BM_sinsp_concatenate_paths_absolute_path_median                +0.1263         +0.1262            52            59            52            59
BM_sinsp_concatenate_paths_absolute_path_stddev                +0.0009         +0.0025             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.1116         -0.1100             0             0             0             0

@ekoops ekoops force-pushed the ekoops/use-scap-errprintf branch 2 times, most recently from 174aafa to 63e5cde Compare February 26, 2025 13:25
Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
@ekoops ekoops force-pushed the ekoops/use-scap-errprintf branch from 63e5cde to 7a87905 Compare February 27, 2025 11:32
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