Skip to content

Conversation

jmccormick7
Copy link

@jmccormick7 jmccormick7 commented Oct 10, 2025

This commit adds event_type to the flb_plugin_proxy_def struct. This allows for the setting of event_type to a value other than the default log only initialization.

In the flb_plugin_proxy_register function default behavior is enforced by checking for unset event_type values. When unset (a value of 0) then log behavior is defaulted. No need for incorrect value checking since this was not a set field in the past. Unset fields are set as current behavior dictates and future use cases using incorrect values can be treated as user error.

Input use case does not use event-type and is unaffected by this change.

Addresses #10995

This PR enables the ability to allow Go plugins to register their event types PR 80

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
  • Attached Valgrind output that shows no leaks or memory corruption was found
100% tests passed, 0 tests failed out of 164

Label Time Summary:
internal    =  85.38 sec*proc (70 tests)
runtime     = 2026.55 sec*proc (83 tests)

Total Test time (real) = 2212.60 sec
==46444== 
==46444== HEAP SUMMARY:
==46444==     in use at exit: 0 bytes in 0 blocks
==46444==   total heap usage: 5,012 allocs, 5,012 frees, 54,842,164 bytes allocated
==46444== 
==46444== All heap blocks were freed -- no leaks are possible
==46444== 
==46444== For lists of detected and suppressed errors, rerun with: -s
==46444== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • 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

  • Bug Fixes

    • Proxy input plugins now register correctly so they are discovered and used by the system.
    • Outputs without an explicit event type default to logs, preventing misclassification.
  • Chores

    • Plugin metadata now explicitly carries an event-type field (logs/metrics/traces) for clearer, more consistent handling.

This commit adds event_type to the flb_plugin_proxy_def struct. This allows for the setting
of event_type to a value other than the default log only initialization.

In the flb_plugin_proxy_register function default behaviour is enforced by checking for unset event_type vlaues.
When unset (a value of 0) then log behaviour is defaulted. No need for incorrect value checking since this
was not a set field in the past. Unset fields are set as current behavior dicates and future usecases using incorrect values can be treated as user error.

Input use case does not use event-type and is unaffected by this change.

Signed-off-by: jmccormick7 <[email protected]>
Copy link

coderabbitai bot commented Oct 10, 2025

Walkthrough

Added a public event_type field to flb_plugin_proxy_def. Output registration now defaults output instances to FLB_OUTPUT_LOGS when def->event_type == 0; input registration adds the input plugin to config->in_plugins. Proxy allocation uses zero-initializing allocation.

Changes

Cohort / File(s) Summary
Public API: Plugin proxy definition
include/fluent-bit/flb_plugin_proxy.h
Added public struct member int event_type to struct flb_plugin_proxy_def.
Proxy registration & allocation
src/flb_plugin_proxy.c
Output registration: if def->event_type == 0 set out->event_type = FLB_OUTPUT_LOGS, otherwise copy def->event_type. Input registration: add input plugin to config->in_plugins via mk_list_add. Allocation: use flb_calloc(1, sizeof(struct flb_plugin_proxy_def)) for zero-initialized proxy->def.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as Plugin provider
  participant Proxy as Plugin proxy
  participant Core as Fluent Bit core
  participant Out as Output instance

  App->>Proxy: supply flb_plugin_proxy_def (event_type maybe 0)
  Proxy->>Core: flb_proxy_register_output(def)
  rect rgba(220,235,255,0.6)
    note over Core: Output registration logic
    Core->>Out: if def.event_type == 0\nset Out.event_type = FLB_OUTPUT_LOGS\nelse set Out.event_type = def.event_type
  end
  Core-->>Proxy: registration complete
Loading
sequenceDiagram
  autonumber
  participant App as Plugin provider
  participant Proxy as Plugin proxy
  participant Core as Fluent Bit core
  participant In as Input instance

  App->>Proxy: supply flb_plugin_proxy_def
  Proxy->>Core: flb_proxy_register_input(def)
  rect rgba(220,255,220,0.6)
    note over Core: Input registration logic
    Core->>Core: mk_list_add(In) into config.in_plugins
  end
  Core-->>Proxy: registration complete
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • edsiper
  • koleini
  • fujimotos

Poem

I nibble at a tiny new field,
event_type snug, all tidy and sealed.
Outputs default to logs when it's nil,
Inputs hop into lists, snug and still.
A rabbit’s whisker tweaks the code—quick and healed. 🐇

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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the primary change—enabling the specification of an event_type for plugin_proxy plugins—and directly aligns with the addition of the event_type field in the pull request, making it clear and specific to reviewers.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b70738 and 82d792a.

📒 Files selected for processing (1)
  • src/flb_plugin_proxy.c (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/flb_plugin_proxy.c

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0def4e6 and 8b70738.

📒 Files selected for processing (2)
  • include/fluent-bit/flb_plugin_proxy.h (1 hunks)
  • src/flb_plugin_proxy.c (2 hunks)

… malloc

Changing intialization to use calloc instead of malloc so that emtpy fields are 0 initialized.
Specifically for the event_type addition.

Signed-off-by: jmccormick7 <[email protected]>
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.

1 participant