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

feat(sinsp/threadinfo): expose thread uid and gid as static fields #2196

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Dec 10, 2024

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 enables access to thread uid and gid as static fields.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@ekoops ekoops force-pushed the ekoops/uid-gid-static-fields branch 2 times, most recently from e99d43b to 7ddcd6b Compare December 10, 2024 15:47
FedeDP
FedeDP previously approved these changes Dec 10, 2024
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.

/approve

@poiana
Copy link
Contributor

poiana commented Dec 10, 2024

LGTM label has been added.

Git tree hash: 17218ace4eb86e69fbf7d45fde0d7fdde7012257

@FedeDP
Copy link
Contributor

FedeDP commented Dec 10, 2024

/milestone 0.20.0

@poiana poiana added this to the 0.20.0 milestone Dec 10, 2024
Andreagit97
Andreagit97 previously approved these changes Dec 10, 2024
Copy link
Member

@Andreagit97 Andreagit97 left a comment

Choose a reason for hiding this comment

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

/approve

@Andreagit97
Copy link
Member

/hold

@Andreagit97
Copy link
Member

You need to update the corresponding test

2024-12-10T16:27:02.9330936Z [ RUN      ] thread_manager.table_access
2024-12-10T16:27:02.9331451Z /__w/libs/libs/userspace/libsinsp/test/state.ut.cpp:381: Failure
2024-12-10T16:27:02.9331926Z Expected equality of these values:
2024-12-10T16:27:02.9332533Z   newt->static_fields().size()
2024-12-10T16:27:02.9332834Z     Which is: 33
2024-12-10T16:27:02.9333103Z   s_threadinfo_static_fields_count
2024-12-10T16:27:02.9333628Z     Which is: 30
2024-12-10T16:27:02.9333924Z [  FAILED  ] thread_manager.table_access (1 ms)
2024-12-10T16:27:02.9334319Z [ RUN      ] thread_manager.fdtable_access

@ekoops ekoops dismissed stale reviews from Andreagit97 and FedeDP via f2e7de5 December 10, 2024 16:40
@ekoops ekoops force-pushed the ekoops/uid-gid-static-fields branch from 7ddcd6b to f2e7de5 Compare December 10, 2024 16:40
@poiana poiana removed the lgtm label Dec 10, 2024
@ekoops
Copy link
Contributor Author

ekoops commented Dec 10, 2024

You need to update the corresponding test

2024-12-10T16:27:02.9330936Z [ RUN      ] thread_manager.table_access
2024-12-10T16:27:02.9331451Z /__w/libs/libs/userspace/libsinsp/test/state.ut.cpp:381: Failure
2024-12-10T16:27:02.9331926Z Expected equality of these values:
2024-12-10T16:27:02.9332533Z   newt->static_fields().size()
2024-12-10T16:27:02.9332834Z     Which is: 33
2024-12-10T16:27:02.9333103Z   s_threadinfo_static_fields_count
2024-12-10T16:27:02.9333628Z     Which is: 30
2024-12-10T16:27:02.9333924Z [  FAILED  ] thread_manager.table_access (1 ms)
2024-12-10T16:27:02.9334319Z [ RUN      ] thread_manager.fdtable_access

Done

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.

/approve

@poiana poiana added the lgtm label Dec 10, 2024
@poiana
Copy link
Contributor

poiana commented Dec 10, 2024

LGTM label has been added.

Git tree hash: 19088f5758d15f82a5790a6a7a4ce5ea7f5cb5ba

Copy link

Perf diff from master - unit tests

    10.21%     -1.10%  [.] sinsp::next
     6.73%     +0.77%  [.] sinsp_evt::get_type
     2.09%     +0.41%  [.] next
     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
     3.65%     -0.31%  [.] sinsp_evt::load_params
     1.17%     -0.30%  [.] 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> >::find
     1.33%     -0.26%  [.] sinsp::fetch_next_event
     0.89%     +0.23%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release
     0.18%     +0.21%  [.] libsinsp::runc::match_container_id
     0.73%     -0.20%  [.] sinsp_evt::get_param

Heap diff from master - unit tests

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

Heap diff from master - scap file

peak heap memory consumption: -408B
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.0015         +0.0014           151           151           151           151
BM_sinsp_split_median                                          +0.0019         +0.0018           150           151           150           151
BM_sinsp_split_stddev                                          -0.6224         -0.6220             2             1             2             1
BM_sinsp_split_cv                                              -0.6230         -0.6226             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0638         -0.0639            61            57            61            57
BM_sinsp_concatenate_paths_relative_path_median                -0.0640         -0.0641            61            57            61            57
BM_sinsp_concatenate_paths_relative_path_stddev                +0.0659         +0.0639             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    +0.1386         +0.1366             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0021         -0.0022            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_median                   -0.0021         -0.0022            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.2251         -0.2255             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.2235         -0.2238             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.1602         -0.1603            67            56            67            56
BM_sinsp_concatenate_paths_absolute_path_median                -0.1656         -0.1657            67            56            67            56
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.6352         -0.6352             1             0             1             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.5656         -0.5655             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0181         +0.0181           385           392           385           392
BM_sinsp_split_container_image_median                          +0.0214         +0.0213           385           393           385           393
BM_sinsp_split_container_image_stddev                          +0.8563         +0.8549             2             5             2             5
BM_sinsp_split_container_image_cv                              +0.8232         +0.8220             0             0             0             0

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.19%. Comparing base (230ddfb) to head (f2e7de5).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2196   +/-   ##
=======================================
  Coverage   75.19%   75.19%           
=======================================
  Files         259      259           
  Lines       33875    33878    +3     
  Branches     5800     5800           
=======================================
+ Hits        25473    25476    +3     
  Misses       8402     8402           
Flag Coverage Δ
libsinsp 75.19% <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
Member

@Andreagit97 Andreagit97 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 Dec 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

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

FedeDP commented Dec 11, 2024

/unhold

@poiana poiana merged commit 0fd43cb into falcosecurity:master Dec 11, 2024
48 of 49 checks passed
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