in_tcp: add source address even when format is none#10264
in_tcp: add source address even when format is none#10264jadeKim1993 wants to merge 2 commits intofluent:masterfrom
Conversation
Signed-off-by: GeunTae Kim <gtkim100@gmail.com>
93c419c to
3a17947
Compare
|
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
|
I have updated the PR description. Please review it at your convenience. |
|
@edsiper this PR is pretty simple and it's covered by a test case, it's ready for the next merge window. |
|
@edsiper could you please make the test cases run so the code doesn't go stale for the next release cycle? It's a really simple change that shouldn't cause any problems. |
|
not sure why CI is now not running, will check. @codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Signed-off-by: jade <54811879+jadeKim1993@users.noreply.github.com>
📝 WalkthroughWalkthroughThis PR extends the TCP input plugin to optionally include the remote source address in output records when Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/runtime/in_tcp.c (1)
687-687: Make the assertion less order-dependent to avoid brittle test failures.Line 687 expects
"log"immediately followed by"source_host". Prefer checking only"source_host":"tcp://here (thelogfield is already covered byflb_test_format_none) or validating both fields independently.♻️ Minimal diff to reduce ordering sensitivity
- cb_data.data = "\"log\":\"message\",\"source_host\":\"tcp://"; + cb_data.data = "\"source_host\":\"tcp://";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/runtime/in_tcp.c` at line 687, The test currently sets cb_data.data to a string that requires the "log" field to appear immediately before "source_host" which makes the assertion order-dependent; change the test so cb_data.data only asserts the presence of the "source_host":"tcp://" fragment (or validate "log" and "source_host" independently) instead of the exact ordering—update the assignment to cb_data.data in tests/runtime/in_tcp.c and adjust any assertions that rely on exact field order (note: flb_test_format_none already covers "log", so keep that check separate).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/runtime/in_tcp.c`:
- Line 687: The test currently sets cb_data.data to a string that requires the
"log" field to appear immediately before "source_host" which makes the assertion
order-dependent; change the test so cb_data.data only asserts the presence of
the "source_host":"tcp://" fragment (or validate "log" and "source_host"
independently) instead of the exact ordering—update the assignment to
cb_data.data in tests/runtime/in_tcp.c and adjust any assertions that rely on
exact field order (note: flb_test_format_none already covers "log", so keep that
check separate).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f192e424-ced0-4ae8-8ab2-c0ffa81c1781
📒 Files selected for processing (2)
plugins/in_tcp/tcp_conn.ctests/runtime/in_tcp.c
Modify to add source_address even when input format is none instead of JSON
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-testlabel to test for all targets (requires maintainer to do).Documentation
Please refer to the official documentation at the following link
(https://github.com/fluent/fluent-bit-docs/blob/master/pipeline/inputs/tcp.md)
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
New Features
format=nonepayload format. Configure this feature using thesource_address_keyoption to store the source address in a custom field.Tests
format=none.