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

fix(libsinsp): fix Falco compilation error on libsinsp_metrics::set_metric_value #1971

Merged

Conversation

LucaGuerra
Copy link
Contributor

@LucaGuerra LucaGuerra commented Jul 22, 2024

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area libsinsp

Does this PR require a change in the driver versions?

No

What this PR does / why we need it:

Fixes the following when building Falco:

/home/ubuntu/dev/falcosecurity/libs/userspace/libsinsp/metrics_collector.h: In instantiation of ‘metrics_v2 libs::metrics::libs_metrics_collector::new_metric(const char*, uint32_t, metrics_v2_value_type, metrics_v2_value_unit, metrics_v2_metric_type, T) [with T = long unsigned int; metrics_v2 = metrics_v2; uint32_t = unsigned int; metrics_v2_value_type = metrics_v2_value_type; metrics_v2_value_unit = metrics_v2_value_unit; metrics_v2_metric_type = metrics_v2_metric_type]’:
/home/ubuntu/dev/falcosecurity/falco/userspace/falco/falco_metrics.cpp:124:77:   required from here
/home/ubuntu/dev/falcosecurity/libs/userspace/libsinsp/metrics_collector.h:349:51: error: ‘static void libs::metrics::libsinsp_metrics::set_metric_value(metrics_v2&, metrics_v2_value_type, T) [with T = long unsigned int; metrics_v2 = metrics_v2; metrics_v2_value_type = metrics_v2_value_type]’ is protected within this context
  349 |                 libsinsp_metrics::set_metric_value(metric, type, val);
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/home/ubuntu/dev/falcosecurity/libs/userspace/libsinsp/metrics_collector.h:218:21: note: declared protected here
  218 |         static void set_metric_value(metrics_v2& metric, metrics_v2_value_type type, T val)
      |                     ^~~~~~~~~~~~~~~~

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@LucaGuerra
Copy link
Contributor Author

/milestone 0.18.0

Copy link

Perf diff from master - unit tests

     6.19%     -0.88%  [.] sinsp_evt::get_type
     0.43%     +0.86%  [.] libsinsp::events::is_unknown_event
     3.79%     +0.80%  [.] sinsp_evt::load_params
     4.38%     +0.73%  [.] sinsp_parser::process_event
     0.32%     +0.70%  [.] libsinsp::state::stl_container_table_adapter<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, libsinsp::state::value_table_entry_adapter<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, libsinsp::state::value_table_entry_adapter<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::dynamic_fields_t>::stl_container_table_adapter
     4.59%     -0.61%  [.] gzfile_read
     2.88%     -0.48%  [.] sinsp_thread_manager::get_thread_ref
     3.94%     -0.48%  [.] std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release
     1.48%     -0.48%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>
     1.05%     +0.42%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>

Perf diff from master - scap file

    11.21%     -4.40%  [.] sinsp_filter_check::tostring
    10.30%     +3.22%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>
    11.22%     +3.00%  [.] sinsp_filter_check::extract_nocache
     7.49%     -2.30%  [.] next
     3.74%     +1.37%  [.] std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>
     7.57%     +1.29%  [.] sinsp_filter_check_thread::extract_single
    18.83%     +0.67%  [.] sinsp_evt_formatter::tostring_withformat
    11.01%     -0.61%  [.] sinsp_filter_check_event::extract_single
     7.38%     -0.37%  [.] sinsp::next
     3.80%     -0.29%  [.] gmt2local

Heap diff from master - unit tests

total runtime: 0.04s.
calls to allocation functions: -609 (-15225/s)
temporary memory allocations: -200 (-5000/s)
peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

Heap diff from master - scap file

total runtime: 0.01s.
calls to allocation functions: 0 (0/s)
temporary memory allocations: 3 (428/s)
peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B

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.

/approve

@poiana
Copy link
Contributor

poiana commented Jul 22, 2024

LGTM label has been added.

Git tree hash: 290455ae332c9c0be3c991ff781a0b7dde4cde50

Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.00%. Comparing base (31d1adf) to head (f2581cf).

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1971    +/-   ##
========================================
  Coverage   51.00%   51.00%            
========================================
  Files         310      310            
  Lines       39570    39570            
  Branches    17487    17818   +331     
========================================
  Hits        20183    20183            
- Misses      14350    14363    +13     
+ Partials     5037     5024    -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 Jul 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, FedeDP, LucaGuerra

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:
  • OWNERS [Andreagit97,FedeDP,LucaGuerra]

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 81f451e into falcosecurity:master Jul 22, 2024
45 of 46 checks passed
@LucaGuerra LucaGuerra deleted the fix/compilation-error-libsinsp-metrics branch July 22, 2024 12:13
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.

4 participants