-
Notifications
You must be signed in to change notification settings - Fork 1.8k
help: add space for outputs and processors when generating schema. #11020
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
Signed-off-by: Phillip Whelan <[email protected]>
WalkthroughAdds a new "processors" entry to the root JSON schema in flb_help_build_json_schema and increments the root map size from 5 to 6, with an updated comment reflecting the additional item. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
* - outputs | ||
*/ | ||
msgpack_pack_map(&mp_pck, 5); | ||
msgpack_pack_map(&mp_pck, 6); |
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.
Nits: This is nitpick but can we generate the number of plugin types here in the future?
This is because this is one of the magic numbers to handle specific not fixed the number of items.
So, we need to handle it with more flexible way.
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'll see what I can do. The best I can think of off the type of my head would be to use a static list and then use a bunch of if branches when recursing that list to add each help section.
I'll test it out later.
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.
you can use this API which solves that problem: https://github.com/fluent/fluent-bit/blob/master/src/flb_mp.c#L258-L296
Description
Problem
The output plugins are not appearing in the JSON output from when generating fluent-bit schema via
./bin/calyptia-fluent-bit -J.
Root Cause
In flb/src/flb_help.c:717, the root msgpack map was initialized with size 5:
msgpack_pack_map(&mp_pck, 5);
However, the code was actually adding 6 entries to the root map:
Because the map was declared with size 5, when msgpack tried to pack 6 entries, the 6th entry ("outputs") was being written to the buffer but wasn't properly included in the map structure, causing it to be silently dropped during JSON conversion.
Fix
Changed line 717 from msgpack_pack_map(&mp_pck, 5) to msgpack_pack_map(&mp_pck, 6) and updated the comment to reflect all 6 entries including "processors".
Verification
All 46 output plugins now appear in the JSON output
The JSON structure includes all 6 root keys: customs, filters, fluent-bit, inputs, outputs, and processors
No debug output is printed to stderr
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:
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.
Summary by CodeRabbit