-
Notifications
You must be signed in to change notification settings - Fork 165
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
fix(libsinsp): enable metrics collector on all platforms #1870
base: master
Are you sure you want to change the base?
Conversation
8b31d31
to
7b2e258
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also wondering whether we should tie available sinsp_stats_v2_collectors
to eg: MINIMAL_BUILD (for example, container-related ones will always be 0 on MINIMAL_BUILD builds).
This should be as simple as adding a compilation guard around collector entries.
@@ -274,9 +272,11 @@ class libs_metrics_collector | |||
uint32_t m_metrics_flags = METRICS_V2_KERNEL_COUNTERS | METRICS_V2_LIBBPF_STATS | METRICS_V2_RESOURCE_UTILIZATION | METRICS_V2_STATE_COUNTERS | METRICS_V2_PLUGINS; | |||
std::vector<metrics_v2> m_metrics; | |||
|
|||
#ifdef __linux__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might want to move these in the scap_platform
vtable, likely as a
struct scap_metrics_vtable
(embedded in each scap_foo_platform
), so that we could get platform-dependent metrics from the scap handle. Again, this might be an idea for a future refactor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't had time to check out this PR but reading your comment @FedeDP I would like that. Especially since the scap refactor the CPU usage calculation is broken when only having a plugin source even when on Linux because we do not instantiate the agent info in that case which is used in the CPU usage calculation.
Since we don't need this for the next release, i'd put this in the |
Ei @FedeDP make sense! |
Added this as item to falcosecurity/falco#3194 (comment). |
Agree!
I think it is interesting to expose those metric for osx and win too, but yes it's not high priority. |
@mrgian hope all is well, just wanted to kindly check in and ask what our current plan is to get out of the regression in our scap platforms approach? (falcosecurity/falco#2821) If we can have a proper refactor -- amazing. Else I would also support something more intermediate to ensure the next Falco release does not have this regression anymore. CC @FedeDP @leogr Thanks in advance! |
Posted here falcosecurity/falco#2821 (comment) |
38e4e48
to
cd54b89
Compare
Seems like this one and #2821 are intertwined :) @mrgian, please take a look at my comment #1969 (comment) for some ideas about the future direction of libscap/libsinsp and scap_platform. IMO, let's move stuff out of libscap, not into (especially here: libscap doesn't care one bit about these metrics, they're purely for libsinsp use). If you agree with that, then I think it's not a good idea to add more stuff to scap_platform. Instead, we can make metrics_collector a virtual base class (this is effectively what a scap_platform is) and move the concrete implementation to e.g. userspace/libsinsp/linux/metrics_collector.cpp. Then, we have two options for the consumers of the metrics:
(I'd rather go for 1, personally) One thing to bikeshed would be the directory structure (it's trivial here, but it will set precedent for future per-platform components). I see two approaches:
I don't have a strong opinion on this either way tbh. |
Ehi @gnosek
If I'm not wrong, currently As you said, taking a decision on the directory naming will influence future components development, so I'll wait to know what the maintainers think. |
Perf diff from master - unit tests
Heap diff from master - unit tests
Heap diff from master - scap file
Benchmarks diff from master
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1870 +/- ##
==========================================
+ Coverage 73.57% 73.69% +0.12%
==========================================
Files 253 255 +2
Lines 31875 31914 +39
Branches 5648 5619 -29
==========================================
+ Hits 23452 23520 +68
+ Misses 8408 8382 -26
+ Partials 15 12 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Confirmed.
Also don't have any preference. Maybe go with what @gnosek deems slightly better, because Grzeg has been around the block for some time and I get all the callouts. The ifdefs were a good solution to get these metrics going. Now we can finally get it right. By now 4+ folks already refactored the libs metrics collector, so there is hope that we will stabilize that code at some point 🙃 . |
Any news on this @mrgian ? |
Ei @FedeDP |
Ok! Moving to next milestone then :) |
b8b3ee8
to
9938e53
Compare
Signed-off-by: Gianmatteo Palmieri <[email protected]>
9938e53
to
d0c2588
Compare
Ehi @incertum @gnosek WDYT? |
/cc @gnosek /milestone 0.20.0 |
What type of PR is this?
Any specific area of the project related to this PR?
/area libsinsp
/area tests
Does this PR require a change in the driver versions?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: