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: add events dimensions file generator in modern probe #2232

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

ekoops
Copy link
Contributor

@ekoops ekoops commented Jan 14, 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 enables automatic generation of driver/modern_bpf/definitions/events_dimensions.h. The new generator, defined in driver/modern_bpf/definitions/generator/generator.cpp, is called by the build system if any modification to the event table is detected. The events dimensions file has been added as a separate dependency to the bpf object file targets.

Which issue(s) this PR fixes:

#2227

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@poiana poiana requested review from hbrueckner and leogr January 14, 2025 16:58
@ekoops ekoops changed the title feat: add events dimensions file generator in modern probe wip: feat: add events dimensions file generator in modern probe Jan 14, 2025
Copy link

github-actions bot commented Jan 14, 2025

Perf diff from master - unit tests

     7.63%     +0.64%  [.] sinsp_evt::get_type
     1.89%     -0.63%  [.] sinsp_evt_filter::sinsp_evt_filter
     5.27%     +0.56%  [.] next_event_from_file
     3.10%     -0.39%  [.] sinsp_thread_manager::get_thread_ref
     3.37%     +0.35%  [.] sinsp_evt::load_params
    10.31%     -0.33%  [.] sinsp_parser::reset
     2.06%     -0.30%  [.] next
     1.04%     -0.21%  [.] sinsp_evt::get_param
     0.87%     +0.20%  [.] sinsp_evt::get_syscall_return_value
     0.93%     +0.18%  [.] sinsp_evt::get_ts

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.0129         -0.0129           151           149           151           149
BM_sinsp_split_median                                          -0.0192         -0.0192           151           148           151           148
BM_sinsp_split_stddev                                          -0.2685         -0.2679             1             1             1             1
BM_sinsp_split_cv                                              -0.2590         -0.2583             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_mean                  -0.0778         -0.0778            61            57            61            57
BM_sinsp_concatenate_paths_relative_path_median                -0.0785         -0.0785            61            57            61            57
BM_sinsp_concatenate_paths_relative_path_stddev                +0.2340         +0.2342             0             0             0             0
BM_sinsp_concatenate_paths_relative_path_cv                    +0.3380         +0.3383             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_mean                     -0.0122         -0.0122            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_median                   -0.0106         -0.0106            25            25            25            25
BM_sinsp_concatenate_paths_empty_path_stddev                   -0.2492         -0.2486             0             0             0             0
BM_sinsp_concatenate_paths_empty_path_cv                       -0.2399         -0.2393             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_mean                  -0.1237         -0.1237            64            56            64            56
BM_sinsp_concatenate_paths_absolute_path_median                -0.1225         -0.1225            63            56            63            56
BM_sinsp_concatenate_paths_absolute_path_stddev                +0.0368         +0.0372             0             0             0             0
BM_sinsp_concatenate_paths_absolute_path_cv                    +0.1832         +0.1837             0             0             0             0
BM_sinsp_split_container_image_mean                            +0.0071         +0.0071           395           397           395           397
BM_sinsp_split_container_image_median                          +0.0097         +0.0096           394           398           394           398
BM_sinsp_split_container_image_stddev                          -0.2354         -0.2364             4             3             4             3
BM_sinsp_split_container_image_cv                              -0.2408         -0.2418             0             0             0             0

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.12%. Comparing base (8362ae9) to head (344e6e1).
Report is 21 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2232      +/-   ##
==========================================
+ Coverage   75.09%   75.12%   +0.02%     
==========================================
  Files         276      276              
  Lines       34391    34400       +9     
  Branches     5927     5921       -6     
==========================================
+ Hits        25826    25843      +17     
+ Misses       8565     8557       -8     
Flag Coverage Δ
libsinsp 75.12% <ø> (+0.02%) ⬆️

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.

@FedeDP
Copy link
Contributor

FedeDP commented Jan 15, 2025

/milestone 0.21.0

@poiana poiana added this to the 0.21.0 milestone Jan 15, 2025
@ekoops ekoops force-pushed the ekoops/events-dimensions-gen branch from 5752742 to 95c1ee8 Compare January 20, 2025 10:42
Copy link

Please double check driver/API_VERSION file. See versioning.

/hold

@ekoops ekoops force-pushed the ekoops/events-dimensions-gen branch from 95c1ee8 to 6780255 Compare January 20, 2025 10:46
@ekoops ekoops changed the title wip: feat: add events dimensions file generator in modern probe feat: add events dimensions file generator in modern probe Jan 20, 2025
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we generate and commit the new file in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The new file is produced at build time, that's why I deleted it. In the previous attempt, I included the generated file in the source, but since it required to be properly formatted (as per clang-format configuration), it required clang-format to be installed on the system. I assume that we don't want to be dependent on a development tool at build time.

Copy link
Member

Choose a reason for hiding this comment

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

what about disabling formatting on this file since it is autogenerated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it works for me. I'll let clang ignore it

Copy link
Contributor

Choose a reason for hiding this comment

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

Mmmh i'd completely drop the file really; it is really error prone to let it lingering in the repo since it is auto-generated. I can't see the point in keeping it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it can help to quickly detect and track variation in the generation behavior, as well as event size variations.

userspace/libscap/engine/modern_bpf/CMakeLists.txt Outdated Show resolved Hide resolved
@ekoops ekoops force-pushed the ekoops/events-dimensions-gen branch from 6780255 to 3457a5a Compare January 20, 2025 13:16
@ekoops ekoops requested a review from Andreagit97 January 20, 2025 13:18
@Andreagit97
Copy link
Member

LGTM! just a compilation error in CI https://github.com/falcosecurity/libs/actions/runs/12868886761/job/35876631053?pr=2232

@ekoops ekoops force-pushed the ekoops/events-dimensions-gen branch from 3457a5a to 344e6e1 Compare January 20, 2025 14:06
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.

Thank you!
/approve

@poiana
Copy link
Contributor

poiana commented Jan 20, 2025

LGTM label has been added.

Git tree hash: 5999e26a71acfe740cf27b2d7c0f77d7441c44ba

@FedeDP
Copy link
Contributor

FedeDP commented Jan 21, 2025

/hold

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 Jan 21, 2025

[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 Jan 21, 2025

/unhold

@poiana poiana merged commit 6c46ed3 into falcosecurity:master Jan 21, 2025
57 checks passed
@ekoops ekoops deleted the ekoops/events-dimensions-gen branch January 23, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants