Skip to content

update(api): Add value offset support #103

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

geraldcombs
Copy link
Contributor

@geraldcombs geraldcombs commented Mar 21, 2025

Add support for FTYPE_METADATA_SLICE and CAP_EXTRACT_METADATA so that we can extract the location of each field.

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 build

/area plugin-sdk

/area tests

What this PR does / why we need it:

This makes it possible to extend extractor plugins so that they can provide the location of each field in each event or log message.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

update(pkg/sdk): add field metadata support

@poiana
Copy link

poiana commented Mar 21, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: geraldcombs
Once this PR has been reviewed and has the lgtm label, please assign jasondellaluce for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extends the SDK's extraction API by adding support for a new field type, FieldMetaTypeSlice, which allows extractor plugins to report field metadata (i.e. the start and end positions of fields).

  • Updated the extract request interface and its SetValue method to support a two-element uint32 pair for metadata.
  • Added new symbols and tests in the info and extract test files to validate the metadata extraction capability.
  • Enhanced the plugin Info structure and documentation to reflect the new metadata capability.

Reviewed Changes

Copilot reviewed 8 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/sdk/extract.go Extended SetValue to support FieldMetaTypeSlice
pkg/sdk/symbols/info/info.go Added get_extract_metadata_capability symbol
pkg/sdk/symbols/info/info_test.go Added tests for extracting metadata capability
pkg/sdk/sdk.go Defined new constant FieldMetaTypeSlice
pkg/sdk/extract_test.go Added helper and tests for the metadata slice extraction
pkg/sdk/plugins/plugins.go Updated Info struct to include metadata capability
pkg/sdk/symbols/doc.go Updated documentation to list get_extract_metadata_capability
Files not reviewed (7)
  • Makefile: Language not supported
  • pkg/loader/plugin_api_include.patch: Language not supported
  • pkg/loader/plugin_loader.c: Language not supported
  • pkg/loader/plugin_loader.h: Language not supported
  • pkg/loader/strlcpy.patch: Language not supported
  • pkg/sdk/plugin_types.h: Language not supported
  • pkg/sdk/plugin_types_include.patch: Language not supported
Comments suppressed due to low confidence (1)

pkg/sdk/extract.go:362

  • [nitpick] The panic message for unsupported lists of slices is terse. Consider enhancing it with additional context about the memory layout restriction that prevents lists of slices from being supported.
case FieldMetaTypeSlice:

@leogr
Copy link
Member

leogr commented Mar 21, 2025

/hold depend on falcosecurity/libs#2322

@geraldcombs geraldcombs force-pushed the slice-ftype branch 12 times, most recently from 3210c82 to f1e688d Compare March 24, 2025 23:16
@geraldcombs geraldcombs force-pushed the slice-ftype branch 3 times, most recently from e499d27 to 3fb7eeb Compare April 10, 2025 00:46
@geraldcombs geraldcombs force-pushed the slice-ftype branch 2 times, most recently from 918aacb to b36359e Compare April 10, 2025 01:24
Add support for setting value offsets during extraction.

Signed-off-by: Gerald Combs <[email protected]>
@geraldcombs geraldcombs changed the title update(api): Add field metadata support update(api): Add value offset support Apr 10, 2025
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.

3 participants