Skip to content

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Mar 19, 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_threadinfo() exposed method and force the other components (i.e.: sinsp_thread_manager, sinsp, sinsp_parser, etc...) to use the threadinfo factory to create a new sinsp_threadinfo object.

Moreover, it extracts the thread manager's dynamic fields initialization from thread manager, and passes them to its constructor from sinsp: this allows to control the dynamic fields in a single place and inject them both on the thread manager and on the threadinfo factory.

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

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

This is a step forward towards #2311 (comment) . Once this is merged, we can isolate sinsp_fdinfo and sinsp_fdtable from sinsp, and remove the mentioned repeated code.

Does this PR introduce a user-facing change?:

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

Remove inspector's `sinsp::build_threadinfo()` exposed method and
force the other components (i.e.: `sinsp_thread_manager`, `sinsp`,
`sinsp_parser`, etc...) to use the threadinfo factory to create a new
`sinsp_threadinfo` object. Moreover, extract the thread manager's
dynamic fields initialization from thread manager, and pass them to
its constructor from sinsp: this allows to control the dynamic
fields in a single place and inject them both on the thread manager
and on the threadinfo factory. Together, these changes reduces the
number of dependencies of components that want to create a new
threadinfo. This step is needed to get rid of the `sinsp` pointer in
`sinsp_thread_manager`.

Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
Copy link

codecov bot commented Mar 19, 2025

Codecov Report

Attention: Patch coverage is 91.11111% with 4 lines in your changes missing coverage. Please review.

Project coverage is 77.17%. Comparing base (328c692) to head (e0529f4).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
userspace/libsinsp/sinsp.cpp 84.21% 3 Missing ⚠️
userspace/libsinsp/sinsp_threadinfo_factory.h 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2319      +/-   ##
==========================================
- Coverage   77.18%   77.17%   -0.01%     
==========================================
  Files         226      226              
  Lines       30154    30158       +4     
  Branches     4605     4608       +3     
==========================================
+ Hits        23274    23275       +1     
- Misses       6880     6883       +3     
Flag Coverage Δ
libsinsp 77.17% <91.11%> (-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

Perf diff from master - unit tests

     6.94%     -1.18%  [.] sinsp::next
     3.66%     +0.84%  [.] next_event_from_file
     0.60%     +0.32%  [.] sinsp_parser::event_cleanup
     0.92%     +0.31%  [.] user_group_updater::~user_group_updater
     5.63%     -0.28%  [.] sinsp_evt::get_type
     1.13%     -0.21%  [.] user_group_updater::user_group_updater
     1.73%     +0.21%  [.] sinsp_thread_manager::get_thread_ref
     0.83%     -0.21%  [.] sinsp_evt::get_ts
     0.54%     -0.19%  [.] sinsp_evt::get_param
     1.59%     -0.16%  [.] is_conversion_needed

Heap diff from master - unit tests

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

Heap diff from master - scap file

peak heap memory consumption: -16B
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.0082         +0.0081           147           148           147           148
BM_sinsp_split_median                                          +0.0100         +0.0099           146           148           146           148
BM_sinsp_split_stddev                                          +0.1532         +0.1527             2             2             2             2
BM_sinsp_split_cv                                              +0.1438         +0.1434             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0481         -0.0482            57            54            57            54
BM_sinsp_concatenate_paths_relative_path_median                -0.0440         -0.0442            56            54            56            54
BM_sinsp_concatenate_paths_relative_path_stddev                -0.1936         -0.1944             1             1             1             1
BM_sinsp_concatenate_paths_relative_path_cv                    -0.1528         -0.1536             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0077         -0.0078            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_median                   -0.0074         -0.0075            24            24            24            24
BM_sinsp_concatenate_paths_empty_path_stddev                   +0.6499         +0.6368             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       +0.6627         +0.6496             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.1074         -0.1075            55            49            55            49
BM_sinsp_concatenate_paths_absolute_path_median                -0.1113         -0.1113            55            48            54            48
BM_sinsp_concatenate_paths_absolute_path_stddev                +0.3257         +0.3223             0             1             0             1
BM_sinsp_concatenate_paths_absolute_path_cv                    +0.4853         +0.4816             0             0             0             0

@poiana
Copy link
Contributor

poiana commented Mar 19, 2025

LGTM label has been added.

Git tree hash: e1ead6de27c9625344e93a15119ccd8b122e3561

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

@github-project-automation github-project-automation bot moved this from Todo to In progress in Falco Roadmap Mar 19, 2025
@FedeDP
Copy link
Contributor

FedeDP commented Mar 19, 2025

/milestone 0.21.'

@poiana
Copy link
Contributor

poiana commented Mar 19, 2025

@FedeDP: The provided milestone is not valid for this repository. Milestones in this repository: [0.21.0, TBD, next-driver]

Use /milestone clear to clear the milestone.

In response to this:

/milestone 0.21.'

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@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 f2c055d into falcosecurity:master Mar 19, 2025
47 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Falco Roadmap Mar 19, 2025
@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
@ekoops ekoops deleted the ekoops/remove-build-threadinfo branch March 19, 2025 11:51
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.

4 participants