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(plugin_api): wrong metric type enums #1885

Merged
merged 3 commits into from
Jun 3, 2024

Conversation

mrgian
Copy link
Contributor

@mrgian mrgian commented May 30, 2024

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:
Fixes wrong metric type enums, which are used to convert plugin metrics to libsinsp metrics.
It also resolves get_metrics symbol in plugins.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

fix(plugin_api): wrong metrics type enums

incertum
incertum previously approved these changes May 30, 2024
Copy link
Contributor

@incertum incertum left a comment

Choose a reason for hiding this comment

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

/approve

Apologies I also totally overlooked this during the last review. Thanks for fixing this.

@poiana
Copy link
Contributor

poiana commented May 30, 2024

LGTM label has been added.

Git tree hash: f189d657c285f57d24903f6f96932698dd4f29bf

@incertum
Copy link
Contributor

/milestone 0.18.0

@poiana poiana added this to the 0.18.0 milestone May 30, 2024
Comment on lines +301 to +307
SS_PLUGIN_METRIC_VALUE_TYPE_U32 = 0,
SS_PLUGIN_METRIC_VALUE_TYPE_S32 = 1,
SS_PLUGIN_METRIC_VALUE_TYPE_U64 = 2,
SS_PLUGIN_METRIC_VALUE_TYPE_S64 = 3,
SS_PLUGIN_METRIC_VALUE_TYPE_D = 4,
SS_PLUGIN_METRIC_VALUE_TYPE_F = 5,
SS_PLUGIN_METRIC_VALUE_TYPE_I = 6,
Copy link
Member

Choose a reason for hiding this comment

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

Technically, this is a backward incompatible change, isn't it?

So, unfortunately, I believe we have to bump the PLUGIN_API_VERSION_MAJOR number.
cc @jasondellaluce

/hold a bit for second opinions

Copy link
Member

Choose a reason for hiding this comment

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

Another option would be:

Since this couldn't be used before (because of the missing registered symbol), we assume the 3.5.0 did not have this feature at all. Thus, just bumping the PLUGIN_API_VERSION_MINOR would be enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

agree @leogr we can consider this feature not yet usable in the current release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yet another option:
Forcing the enum values in metrics_v2.h (https://github.com/falcosecurity/libs/blob/master/userspace/libscap/metrics_v2.h) to match the enums in plugin_types.h
This should work given that these enums are only casted here https://github.com/falcosecurity/libs/blob/master/userspace/libsinsp/plugin.cpp#L947-L948

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with Leo, since it was unusable in 0.17.1, we can consider a minor bump.

Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
@mrgian
Copy link
Contributor Author

mrgian commented May 31, 2024

Bumped PLUGIN_API_VERSION_MINOR :)

* plugins metrics
*/

if(m_metrics_flags & METRICS_V2_PLUGINS)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this moved?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we insert plugin metrics first in the vector, they then get overwritten by scap/sinsp metrics.
I didn't look closely at it, but the cause may be: https://github.com/falcosecurity/libs/blob/master/userspace/libsinsp/metrics_collector.cpp#L487

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 Jun 3, 2024

LGTM label has been added.

Git tree hash: 8226f3453afceed9b4598a717941899147df60ab

@FedeDP
Copy link
Contributor

FedeDP commented Jun 3, 2024

/milestone 0.17.2

@poiana poiana modified the milestones: 0.18.0, 0.17.2 Jun 3, 2024
@poiana
Copy link
Contributor

poiana commented Jun 3, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: FedeDP, incertum, jasondellaluce, mrgian

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 [FedeDP,incertum,jasondellaluce]

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 Jun 3, 2024

/unhold

@poiana poiana merged commit c6ff3d0 into falcosecurity:master Jun 3, 2024
40 checks passed
@FedeDP FedeDP mentioned this pull request Jun 13, 2024
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.

6 participants