-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
config_format: yaml: Support passing arbitrary objects to processors #8874
Conversation
e766f24
to
6afb673
Compare
605a4aa
to
e48c8ce
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.
Could you submit your cfl patches into https://github.com/fluent/cfl repo?
@cosmo0920 I'm not certain these patches are a good idea. I only did this as a quick workaround to allow both the processor plugin and the engine to have a reference to the same values (shared ownership doesn't seem such a good idea in this case). I can imagine two better solutions to the problem:
In any case, would be better to do this separately from the yaml-specific changes. I can remove the last two commits of this PR so we can merge without CFL changes. What do you think? |
I like this option if applicative this selection should make to be able to implement another place to handle the reference and malloc/free management.
Not sure we could implement this mechanism. Because all of hot-reloading should be completed in flb_reload.c. |
This was initially based on fluent#8656 and fluent#8661 but ended up making few different choices: - Instead of adding FLB_CONFIG_MAP_KVLIST and FLB_CONFIG_MAP_ARRAY as config map types, it adds a single FLB_CONFIG_MAP_VARIANT which accepts an array or map. The passed array/map can have nested values and accept any JSON/YAML types, which are converted to cfl types. The processor will simply receive a `cfl_variant` pointer but doesn't own it, the config section is responsible for releasing its memory. - The existing `flb_config_map_set` function is reused by passing the `cfl_variant` pointer (from the yaml parsing phase) as the value of a `flb_kv`. Then pointer is eventually passed to the processor context. Signed-off-by: Thiago Padilha <[email protected]>
e48c8ce
to
7edb1af
Compare
As discussed privately with @cosmo0920 , I have removed the example processor and CFL changes since they belong in a different PR |
I see some comments from @pwhelan on this one, are we expecting more changes or a different proposal ? |
ping @pwhelan |
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.
LGTM
This was initially based on
#8656 and #8661 but ended up making few different choices:
cfl_variant
pointer and is responsible for releasing the memory later.flb_config_map_set
function is reused by passing thecfl_variant
pointer (from the yaml parsing phase) as the value of aflb_kv
. Then pointer is eventually moved into the processor context.I have added an example processor which uses the new feature, here's a config that can be used to test it:
This example processor is optional and required some small changes to the CFL library. I only put this processor to make it easier testing the new YAML feature. I can also remove this example processor (and the CFL changes) before it is merged.
Here's a command to run it locally and demonstrate the yaml parsing using JSON syntax highlighting:
@pwhelan @cosmo0920
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.