Skip to content

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Mar 13, 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 removes inspector's sinsp::build_fdinfo() exposed method and forces the other components (i.e.: sinsp_threadinfo, sinsp_thread_manager, etc...) to use the fdinfo factory to create a new sinsp_fdinfo object.

Moreover, it removes the dependency of sinsp_fdinfo_factory from sinsp_thread_manager.

Together, these changes reduces the number of dependencies of components that want to create a new fdinfo. This step is needed to get rid of the sinsp pointer in fdtable, sinsp_thread_manager and sinsp_threadinfo.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

feat(userspace/libsinsp)!: remove `sinsp::build_fdinfo()`

@ekoops
Copy link
Contributor Author

ekoops commented Mar 13, 2025

/hold
This requires a rebase on top of #2296, once it will be approved

@ekoops ekoops force-pushed the ekoops/remove-build-fdinfo branch from 555aed6 to b839a99 Compare March 17, 2025 10:21
Copy link

codecov bot commented Mar 17, 2025

Codecov Report

Attention: Patch coverage is 98.59155% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.17%. Comparing base (69501f6) to head (582179c).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/sinsp.cpp 83.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2311   +/-   ##
=======================================
  Coverage   77.16%   77.17%           
=======================================
  Files         224      224           
  Lines       30135    30149   +14     
  Branches     4605     4605           
=======================================
+ Hits        23254    23267   +13     
- Misses       6881     6882    +1     
Flag Coverage Δ
libsinsp 72.13% <98.59%> (-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.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

github-actions bot commented Mar 17, 2025

Perf diff from master - unit tests

     2.91%     -0.57%  [.] gzfile_read
     8.56%     +0.52%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release
     2.37%     -0.46%  [.] sinsp_thread_manager::find_thread
     5.99%     +0.34%  [.] sinsp_parser::reset
     1.09%     -0.30%  [.] libsinsp::sinsp_suppress::process_event
     0.52%     +0.27%  [.] sinsp_evt::get_direction
     3.66%     +0.22%  [.] next_event_from_file
     1.68%     +0.20%  [.] sinsp_parser::process_event
     0.78%     +0.19%  [.] sinsp::fetch_next_event
     0.40%     -0.18%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>

Heap diff from master - unit tests

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

Heap diff from master - scap file

peak heap memory consumption: -4.03K
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.0548         +0.0547           149           157           149           157
BM_sinsp_split_median                                          +0.0537         +0.0536           148           156           148           156
BM_sinsp_split_stddev                                          +1.3180         +1.3174             1             2             1             2
BM_sinsp_split_cv                                              +1.1976         +1.1971             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0269         -0.0270            62            60            62            60
BM_sinsp_concatenate_paths_relative_path_median                -0.0241         -0.0242            61            60            61            60
BM_sinsp_concatenate_paths_relative_path_stddev                -0.6753         -0.6752             1             0             1             0
BM_sinsp_concatenate_paths_relative_path_cv                    -0.6664         -0.6662             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     +0.0469         +0.0468            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_median                   +0.0466         +0.0465            24            25            24            25
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.6493         +0.6529             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.5754         +0.5790             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  +0.0378         +0.0377            55            57            55            57
BM_sinsp_concatenate_paths_absolute_path_median                +0.0418         +0.0417            55            57            55            57
BM_sinsp_concatenate_paths_absolute_path_stddev                -0.7263         -0.7263             1             0             1             0
BM_sinsp_concatenate_paths_absolute_path_cv                    -0.7363         -0.7362             0             0             0             0

@ekoops
Copy link
Contributor Author

ekoops commented Mar 17, 2025

/unhold

Copy link
Contributor

@mstemm mstemm left a comment

Choose a reason for hiding this comment

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

Overall the changes look okay. I'd suggest relying more on the existing constructors in test code to avoid having to copy the arguments to threadinfo constructors all over the place.

@github-project-automation github-project-automation bot moved this from Todo to In progress in Falco Roadmap Mar 17, 2025
@ekoops ekoops requested a review from mstemm March 17, 2025 18:28
Remove inspector's `sinsp::build_fdinfo()` exposed method and force
the other components (i.e.: `sinsp_threadinfo`,
`sinsp_thread_manager`, etc...) to use the fdinfo factory to create a
new `sinsp_fdinfo` object. Moreover, remove the dependency of
`sinsp_fdinfo_factory` from `sinsp_thread_manager`. Together, these
changes reduces the number of dependencies of components that want to
create a new fdinfo. This step is needed to get rid of the `sinsp`
pointer in `fdtable`, `sinsp_thread_manager` and `sinsp_threadinfo`.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
@ekoops ekoops force-pushed the ekoops/remove-build-fdinfo branch from b839a99 to 582179c Compare March 18, 2025 10:15
@poiana poiana added the lgtm label Mar 18, 2025
@poiana
Copy link
Contributor

poiana commented Mar 18, 2025

LGTM label has been added.

Git tree hash: fadb09b2809b61115e634fe35fcc8c2dcff1f2e5

@leogr leogr requested a review from Copilot March 18, 2025 16:36
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (13)
  • test/libsinsp_e2e/threadinfo.cpp: Language not supported
  • userspace/libsinsp/fdtable.cpp: Language not supported
  • userspace/libsinsp/fdtable.h: Language not supported
  • userspace/libsinsp/sinsp.cpp: Language not supported
  • userspace/libsinsp/sinsp.h: Language not supported
  • userspace/libsinsp/sinsp_external_processor.h: Language not supported
  • userspace/libsinsp/sinsp_fdinfo_factory.h: Language not supported
  • userspace/libsinsp/state/table.h: Language not supported
  • userspace/libsinsp/test/classes/sinsp_thread_manager.cpp: Language not supported
  • userspace/libsinsp/test/classes/sinsp_threadinfo.cpp: Language not supported
  • userspace/libsinsp/test/classes/thread_group_info.cpp: Language not supported
  • userspace/libsinsp/threadinfo.cpp: Language not supported
  • userspace/libsinsp/threadinfo.h: Language not supported

@FedeDP
Copy link
Contributor

FedeDP commented Mar 19, 2025

/approve

@poiana
Copy link
Contributor

poiana commented Mar 19, 2025

[APPROVALNOTIFIER] This PR is APPROVED

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

@poiana poiana merged commit 9c6d68a into falcosecurity:master Mar 19, 2025
46 of 47 checks passed
@FedeDP
Copy link
Contributor

FedeDP commented Mar 19, 2025

/milestone 0.21.0

@poiana poiana added this to the 0.21.0 milestone Mar 19, 2025
@github-project-automation github-project-automation bot moved this from In progress to Done in Falco Roadmap Mar 19, 2025
@ekoops ekoops deleted the ekoops/remove-build-fdinfo branch March 19, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants