Skip to content

Conversation

pwhelan
Copy link
Contributor

@pwhelan pwhelan commented Oct 8, 2025

Summary

Add support for net.* properties for in_calyptia_fleet, ie: net.dns.mode to TCP for some networks or setting the net.dns.resolver to use the legacy DNS resolver.

Description

This PR hooks up the support for net* properties for the upstream connection the in_calyptia_fleet plugin uses. Among the main reasons for this is for the support for setting the dns resolver.

This requires a change to the custom_calyptia plugin as well. With this PR it is now possible to configure the network settings like so:

[CUSTOM]
    Name calyptia
    Fleet_Name test-fleet
    net.dns.resolver legacy
    net.connect_timeout 60
    API_KEY ********

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:

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

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

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

  • New Features
    • Configure a custom machine ID via plugin settings.
  • Behavior Changes
    • Network properties set on the input are now applied to Fleet configuration and Cloud output for consistent connectivity.
    • Upstream connections inherit input network configuration for improved compatibility with custom network environments.
  • Bug Fixes
    • Initialization of network-properties in tests to prevent uninitialized-list issues.

Copy link

coderabbitai bot commented Oct 8, 2025

Walkthrough

Propagates input network properties into Calyptia custom plugin (fleet input and cloud output) and Calyptia Fleet input, adds a configurable machine_id, initializes input net_properties in tests, and registers the custom plugin with the FLB_CUSTOM_NET_CLIENT flag. Also sets upstream parameters from input config.

Changes

Cohort / File(s) Summary of Changes
Custom plugin: net_properties propagation
plugins/custom_calyptia/calyptia.c
Iterate ctx->ins->net_properties in set_fleet_input_properties and setup_cloud_output, applying each key/value to fleet input and cloud output. Introduced local iterators (head, tmp, keyval).
Custom plugin: config + registration
plugins/custom_calyptia/calyptia.c
Added machine_id (FLB_CONFIG_MAP_STR) to config_map[]. Set .flags = FLB_CUSTOM_NET_CLIENT in custom_calyptia_plugin initializer.
Fleet input: net_properties + upstream
plugins/in_calyptia_fleet/in_calyptia_fleet.c
Include c_ins->net_properties when gathering fleet properties (fleet_config_get_properties). Call flb_input_upstream_set(ctx->u, ctx->ins) after upstream init to apply input network settings.
Tests: init net_properties
tests/runtime/custom_calyptia_input_test.c
Initialize t_ctx->ctx->ins->net_properties with mk_list_init(...) during test setup.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User as User Config
  participant CP as custom_calyptia
  participant Fleet as Fleet Input
  participant Cloud as Cloud Output

  rect rgba(220,240,255,0.4)
  note over CP: Plugin init
  User->>CP: Load config (machine_id, net_properties)
  CP->>CP: register plugin (.flags = FLB_CUSTOM_NET_CLIENT)
  CP->>Fleet: set_fleet_input_properties(...)
  loop for each net_property
    CP->>Fleet: apply property (key=value)
  end
  CP->>Cloud: setup_cloud_output(...)
  loop for each net_property
    CP->>Cloud: set property (key=value)
  end
  end
Loading
sequenceDiagram
  autonumber
  participant IF as in_calyptia_fleet
  participant UP as Upstream (HTTP)
  participant Cfg as Fleet Config

  rect rgba(235,255,235,0.4)
  note over IF: Initialization
  IF->>UP: initialize upstream
  IF->>UP: flb_input_upstream_set(ctx->u, ctx->ins)
  IF->>Cfg: fleet_config_get_properties(base_props)
  IF->>Cfg: fleet_config_get_properties(c_ins->net_properties)
  Cfg-->>IF: merged properties
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • edsiper
  • koleini
  • fujimotos

Poem

I twitch my ears at keys and nets,
I hop through props and tiny sets.
machine_id found, flags set just right,
Upstream tuned, properties in flight.
A bunny nods — integrations delight. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title accurately and concisely describes the primary change of the pull request by specifying the plugin and the addition of net.* property support for its upstream connection, making it clear and directly related to the main functionality introduced.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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-fleet-set-upstream-net-properties

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: 0

🧹 Nitpick comments (2)
plugins/custom_calyptia/calyptia.c (2)

218-220: Remove unused variable tmp.

The variable tmp is declared but never used in the set_fleet_input_properties function. Only head and keyval are needed for the net_properties iteration at lines 262-266.

Apply this diff to remove the unused variable:

     struct mk_list *head;
-    struct mk_list *tmp;
     struct flb_kv *keyval;

280-281: Remove unused variable tmp.

The variable tmp is declared but never used in the setup_cloud_output function. Only keyval is needed for the net_properties iteration at lines 369-373.

Apply this diff to remove the unused variable:

-    struct mk_list *tmp;
     struct flb_kv *keyval;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b778a42 and ad5abbd.

📒 Files selected for processing (2)
  • plugins/custom_calyptia/calyptia.c (6 hunks)
  • plugins/in_calyptia_fleet/in_calyptia_fleet.c (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
plugins/in_calyptia_fleet/in_calyptia_fleet.c (1)
src/flb_input.c (1)
  • flb_input_upstream_set (2207-2226)
plugins/custom_calyptia/calyptia.c (2)
src/flb_input.c (1)
  • flb_input_set_property (557-774)
src/flb_output.c (1)
  • flb_output_set_property (834-1056)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (30)
  • GitHub Check: pr-windows-build / call-build-windows-package (Windows 64bit, x64, x64-windows-static, 3.31.6)
  • GitHub Check: pr-windows-build / call-build-windows-package (Windows 32bit, x86, x86-windows-static, 3.31.6)
  • GitHub Check: pr-windows-build / call-build-windows-package (Windows 64bit (Arm64), amd64_arm64, -DCMAKE_SYSTEM_NAME=Windows -DCMA...
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_ARROW=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_COVERAGE=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, clang, clang++)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-22.04, clang-12)
  • GitHub Check: pr-compile-without-cxx (3.31.6)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-22.04, clang-12)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-24.04, clang-14)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-24.04, clang-14)
  • GitHub Check: pr-compile-centos-7
  • GitHub Check: PR - fuzzing test
🔇 Additional comments (6)
plugins/in_calyptia_fleet/in_calyptia_fleet.c (2)

1886-1886: LGTM! Net properties correctly emitted to fleet config.

The addition properly includes network properties (net.*) in the generated fleet configuration alongside regular properties. This enables the network settings to be persisted and applied to fleet components.


2547-2549: LGTM! Upstream network settings properly propagated.

The call to flb_input_upstream_set correctly propagates the input instance's network settings (parsed from net.* properties) to the upstream connection. This is the standard pattern for applying network configuration to upstream connections.

plugins/custom_calyptia/calyptia.c (4)

262-266: LGTM! Network properties correctly propagated to fleet input.

The iteration properly applies each network property from the custom plugin instance to the fleet input. This enables users to configure network settings like net.dns.mode or net.connect_timeout on the custom Calyptia plugin, which then flow through to the underlying fleet input.


369-373: LGTM! Network properties correctly propagated to cloud output.

The iteration properly applies each network property from the custom plugin instance to the Calyptia cloud output. This ensures network configuration settings are consistently applied across both the fleet input and cloud output components.


749-753: LGTM! Machine ID configuration option added.

The new machine_id configuration option allows users to provide a custom machine identifier instead of using the auto-generated one. This is useful for fleet deployments where stable, predetermined machine IDs are required.


812-812: LGTM! Plugin properly registered as network client.

The FLB_CUSTOM_NET_CLIENT flag is necessary for the configuration parser to recognize and store net.* properties in the plugin instance's net_properties list. This enables the net.* property support added throughout this PR.

@pwhelan
Copy link
Contributor Author

pwhelan commented Oct 8, 2025

Here is the debug.log: debug.log

Here is the valgrind.log:
valgrind.log

This log exhibits the same dlopen problem as the previous PR #10996.

… custom calyptia plugin.

Signed-off-by: Phillip Whelan <[email protected]>
@pwhelan
Copy link
Contributor Author

pwhelan commented Oct 8, 2025

There was a flake in the [flb-rt-core_log](https://github.com/fluent/fluent-bit/actions/runs/18347884770/job/52259429970?pr=10998#step:7:4053) test:

        Start  52: flb-rt-core_log
 49/165 Test  #52: flb-rt-core_log ..................................***Failed    8.00 sec
Test not_truncated_log...                       [2025/10/08 14:32:39.807409298] [ info] [fluent bit] version=4.1.1, commit=9038f27cbd, pid=20997
[2025/10/08 14:32:39.807451858] [debug] [engine] coroutine stack size: 24576 bytes (24.0K)
[2025/10/08 14:32:39.807490821] [ info] [storage] ver=1.5.3, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/10/08 14:32:39.807508333] [ info] [simd    ] disabled
[2025/10/08 14:32:39.807514615] [ info] [cmetrics] version=1.0.5
[2025/10/08 14:32:39.807523992] [ info] [ctraces ] version=0.6.6
[2025/10/08 14:32:39.807585978] [ info] [input:lib:lib.0] initializing
[2025/10/08 14:32:39.807594984] [ info] [input:lib:lib.0] storage_strategy='memory' (memory only)
[2025/10/08 14:32:39.807609782] [debug] [lib:lib.0] created event channels: read=26 write=27
[2025/10/08 14:32:39.807687868] [debug] [lib:lib.0] created event channels: read=30 write=31
[2025/10/08 14:32:39.807792913] [ info] [sp] stream processor started
[2025/10/08 14:32:39.807844289] [ info] [engine] Shutdown Grace Period=1, Shutdown Input Grace Period=0
[2025/10/08 14:32:39.999938265] [debug] [task] created task=0x7f8d9c02b700 id=0 OK
[2025/10/08 14:32:40.57547] [debug] [out flush] cb_destroy coro_id=0
[2025/10/08 14:32:40.78837] [debug] [task] destroy task=0x7f8d9c02b700 (task_id=0)
[2025/10/08 14:32:40.807936373] [ warn] [engine] service will shutdown in max 1 seconds
[2025/10/08 14:32:40.807956821] [ info] [engine] pausing all inputs..
[2025/10/08 14:32:41.800014646] [ info] [engine] service has stopped (0 pending tasks)
[ OK ]
Test truncated_log...                           [2025/10/08 14:32:41.802838985] [ info] [fluent bit] version=4.1.1, commit=9038f27cbd, pid=21009
[2025/10/08 14:32:41.802901482] [debug] [engine] coroutine stack size: 24576 bytes (24.0K)
[2025/10/08 14:32:41.802942969] [ info] [storage] ver=1.5.3, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/10/08 14:32:41.802956835] [ info] [simd    ] disabled
[2025/10/08 14:32:41.802962225] [ info] [cmetrics] version=1.0.5
[2025/10/08 14:32:41.802971091] [ info] [ctraces ] version=0.6.6
[2025/10/08 14:32:41.803024531] [ info] [input:lib:lib.0] initializing
[2025/10/08 14:32:41.803033337] [ info] [input:lib:lib.0] storage_strategy='memory' (memory only)
[2025/10/08 14:32:41.803047043] [debug] [lib:lib.0] created event channels: read=26 write=27
[2025/10/08 14:32:41.803117374] [debug] [lib:lib.0] created event channels: read=30 write=31
[2025/10/08 14:32:41.803215216] [ info] [sp] stream processor started
[2025/10/08 14:32:41.803264919] [ info] [engine] Shutdown Grace Period=1, Shutdown Input Grace Period=0
[2025/10/08 14:32:41.999907272] [debug] [task] created task=0x7f8d9c02b700 id=0 OK
[2025/10/08 14:32:42.302829] [debug] [out flush] cb_destroy coro_id=0
[2025/10/08 14:32:42.317476] [debug] [task] destroy task=0x7f8d9c02b700 (task_id=0)
[2025/10/08 14:32:42.803357491] [ warn] [engine] service will shutdown in max 1 seconds
[2025/10/08 14:32:42.803379712] [ info] [engine] pausing all inputs..
[2025/10/08 14:32:43.799946271] [ info] [engine] service has stopped (0 pending tasks)
[ OK ]
Test resize...                                  [ FAILED ]

I restarted the test for now but it would be a good idea to investigate later. At first glance it does not seem to be due to noisy neighbors.

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