Skip to content

Conversation

pwhelan
Copy link
Contributor

@pwhelan pwhelan commented Oct 14, 2025

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:

  • fluent-bit
  • customs
  • inputs
  • processors (this was missing from the comment)
  • filters
  • outputs

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:

  • [N/A] Example configuration file for the change
  • [N/A] Debug log output from testing the change
  • [N/A] Attached Valgrind output that shows no leaks or memory corruption was found

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • Backport to latest stable release.

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

  • New Features
    • Introduced a new "processors" section in the root JSON schema, enabling configuration of processors with schema-based validation.
    • Improves editor auto-completion and validation feedback for processor-related settings.
    • Enhances help and tooling by recognizing processors at the top level of configuration.

Copy link

coderabbitai bot commented Oct 14, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary
Schema root update
src/flb_help.c
Added "processors" field to root JSON schema; increased root map item count from 5→6; adjusted inline comment accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A nibble of schema, a hop through the trees,
I added “processors” with whiskered ease.
Six little carrots in the JSON bed,
Counting them twice with a bobbing head.
Thump-thump! Approvals, please—
For tidy roots and structured breeze. 🥕🌿

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and succinctly describes the primary change of allocating additional entries for outputs and processors in the schema generator, directly reflecting the update of increasing the root map size and matching the pull request’s intent.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pwhelan-fix-schema-outputs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

* - outputs
*/
msgpack_pack_map(&mp_pck, 5);
msgpack_pack_map(&mp_pck, 6);
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Member

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

@edsiper edsiper merged commit 36db973 into master Oct 18, 2025
59 checks passed
@edsiper edsiper deleted the pwhelan-fix-schema-outputs branch October 18, 2025 00:36
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.

5 participants