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 libsinsp sub-components #14

Merged
merged 9 commits into from
Mar 29, 2021
Merged

Conversation

leogr
Copy link
Member

@leogr leogr commented Mar 4, 2021

What type of PR is this?

/kind cleanup

Any specific area of the project related to this PR?

/area build
/area libsinsp

What this PR does / why we need it:

This PR aims to refactor 2 libsinp sub-components in the following way:

  • curseui implementation is removed (and will be ported back to draios/sysdig by follow up for libs' sub-components refactoring draios/sysdig#1747), which also allows removing the ncurses dependency
  • chisel implementation is moved under its own directory (ie. userspace/chisel) and its inclusion is controlled by a cmake option WITH_CHISEL (disabled by default)
  • minor cleanups and renamings

N.B.:
Those sub-components rely on several extension points that were implemented by using the friend class mechanism. The extension points are untouched, refactoring them is outside the scope of this PR.

Special notes for your reviewer:

We will need to introduce a new CI job to build the libraries with -DWITH_CHISEL=True

Does this PR introduce a user-facing change?:

update(userspace/libsinsp): remove curseui support
new: add `WITH_CHISEL` cmake option, disabled by default

@poiana poiana requested review from fntlnz and leodido March 4, 2021 17:42
@poiana poiana added the size/XXL label Mar 4, 2021
@leogr leogr force-pushed the refactor/sub-components-2 branch from d0b5298 to 1ff71fd Compare March 5, 2021 12:32
@leogr leogr force-pushed the refactor/sub-components-2 branch 3 times, most recently from d31504c to 85800dc Compare March 5, 2021 15:18
@leogr leogr changed the title wip: refactor libsinsp sub-components refactor libsinsp sub-components Mar 9, 2021
leogr added 9 commits March 18, 2021 11:30
This commit assumes those sub-components will be ported back to draios/sysdig

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Note about `CHISELS_INSTALLATION_DIR`:
Only the library consumer uses it, so we can safely move it away.

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
@leogr leogr force-pushed the refactor/sub-components-2 branch from 85800dc to e73587d Compare March 18, 2021 10:50
@leogr leogr requested a review from gnosek March 19, 2021 09:43
Copy link
Contributor

@gnosek gnosek left a comment

Choose a reason for hiding this comment

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

LGTM. Not approving yet because I want to know your thoughts about a separate chisel library and I'm afraid poiana will spoil the fun.

Comment on lines +93 to +101
if(WITH_CHISEL)
list(APPEND SINSP_SOURCES
../chisel/chisel_api.cpp
../chisel/chisel_fields_info.cpp
../chisel/chisel_utils.cpp
../chisel/chisel.cpp
../chisel/lua_parser_api.cpp
../chisel/lua_parser.cpp)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be a separate libsinspchisel.a? We'd lose one build-time variable for libsinsp, at least

Copy link
Member Author

Choose a reason for hiding this comment

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

Short answer
it could be, but it's outside the scope of this PR :)

Long answer
The main goal of this PR is to reduce the external dependencies by moving out those sub-components (which should not part of libsinsp by default). When doing that, I've realized there are a lot of further improvements that can be done, but the set of modifications required just to move them away was already too big. In particular, I have noticed they are tightly coupled with libsinsp internals, most of the implementation relies on friend classes, unfortunately. So I decided to keep things simple and reduce the scope of this PR as minimal as possible (that's XXL size anyways). Basically, you should think about this PR as a baby step.
For those reasons, I really think that we should first review the implementation and then make libsinspchisel.a a thing, eventually.

@poiana
Copy link
Contributor

poiana commented Mar 22, 2021

LGTM label has been added.

Git tree hash: 57d6db1212541bed93e5c611eb054c4a735b91f3

@fntlnz
Copy link
Contributor

fntlnz commented Mar 23, 2021

/hold
to let other PRs go in

@gnosek gnosek mentioned this pull request Mar 26, 2021
Copy link
Member

@leodido leodido left a comment

Choose a reason for hiding this comment

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

I believe it is important this goes in before any further work on the CMakeFiles for various reasons:

  • it removes things not belonging to this repo conceptually (but rather belonging to draios/sysdig)
  • it isolates chisels source code

LGTM

@poiana
Copy link
Contributor

poiana commented Mar 29, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gnosek, leodido

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

@leodido
Copy link
Member

leodido commented Mar 29, 2021

/hold cancel

@poiana poiana merged commit 357c4ba into master Mar 29, 2021
@poiana poiana deleted the refactor/sub-components-2 branch March 29, 2021 09:32
leogr added a commit to draios/sysdig that referenced this pull request Mar 29, 2021
See:
- falcosecurity/libs#14
- #1747

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
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.

5 participants