-
Notifications
You must be signed in to change notification settings - Fork 17
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
Conversation
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.
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:
/hold depend on falcosecurity/libs#2322 |
3210c82
to
f1e688d
Compare
3fb7eeb
to
918aacb
Compare
918aacb
to
b36359e
Compare
b36359e
to
63792cd
Compare
b919b5e
to
b02a6c2
Compare
f334e6b
to
41e2df3
Compare
Add support for setting value offsets during extraction. Signed-off-by: Gerald Combs <[email protected]>
Signed-off-by: Leonardo Grasso <[email protected]>
Signed-off-by: Leonardo Grasso <[email protected]>
Co-authored-by: Gerald Combs <[email protected]> Co-authored-by: Leonardo Di Giovanna <[email protected]> Signed-off-by: Leonardo Grasso <[email protected]>
Signed-off-by: Gerald Combs <[email protected]>
Signed-off-by: Gerald Combs <[email protected]>
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've just found an issue (see the comment below); otherwise, SGTM.
By the way, I can try to work on addressing this last thing.
pkg/sdk/extract.go
Outdated
C.free(e.startArrayPtr) | ||
C.free(e.lengthArrayPtr) |
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.
This is precisely what I wanted to do from the beginning. Unfortunately, it's not enough since memory is allocated multiple times here by calloc
in plugin_extract_fields_sync() (which is invoked on every extraction request) and freed only once here (when the extractRequestPool
gets cleaned up by plugin_close()).
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.
Here's my tentative: 1ffcf7a
Signed-off-by: Leonardo Grasso <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: geraldcombs, jasondellaluce 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 |
LGTM label has been added. Git tree hash: 77cb41db82471aabc4a8ad85006dedb50bc2d0a0
|
/hold cancel |
Add support for setting value offsets during extraction.
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area plugin-sdk
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?: