-
Notifications
You must be signed in to change notification settings - Fork 1.9k
in_http: add support for fixed tag configuration parameter #11413
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
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughAdds a configurable fixed_tag to the HTTP input plugin: new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a7ced7459
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Renamed 'tag' config parameter to 'fixed_tag' to avoid collision with global input tag property handled by flb_input_set_property. Signed-off-by: Arbin <arbin.cheng@coins.ph>
2a7ced7 to
97fd309
Compare
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tests/runtime/in_http.c`:
- Around line 987-996: flb_http_add_header is called before confirming the HTTP
client pointer c was successfully created; reorder the checks so you first
verify c != NULL (the result of flb_http_client) and handle the error (TEST_MSG
and early exit) before calling flb_http_add_header, keeping the same variable
names (c) and functions (flb_http_client, flb_http_add_header) to locate and
update the logic.
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@tests/runtime/in_http.c`:
- Around line 944-1022: The test flb_test_http_fixed_tag sets a config with the
wrong key ("tag") so the plugin's "fixed_tag" option is never applied; update
the flb_input_set call in flb_test_http_fixed_tag to use the correct config key
name "fixed_tag" (i.e., replace the "tag" argument passed to flb_input_set with
"fixed_tag") so the fixed tag configuration is actually applied when the test
runs.
Fix two issues in flb_test_http_fixed_tag(): 1. Check if HTTP client pointer c is not NULL before calling flb_http_add_header to prevent potential null pointer dereference 2. Use correct config key 'fixed_tag' instead of 'tag' to properly apply the fixed tag configuration Signed-off-by: Arbin <arbin.cheng@coins.ph>
896ebea to
9cbabc7
Compare
Add Fixed Tag Configuration Parameter to in_http Plugin
Description
This PR adds support for a
tagconfiguration parameter in thein_httpinput plugin, allowing users to specify a fixed tag for all incoming records. This addresses scenarios where users want consistent tagging without relying on URL paths or dynamic extraction from record content.Problem Statement
Currently, the
in_httpplugin determines tags using the following logic:tag_keyis configuredhttp.0)This creates issues when:
http.0tag doesn't match their routing configurationSolution
Added a new
tagconfiguration parameter that allows users to specify a fixed tag. The updated tag selection priority is now:http.0)Changes
Source Code
flb_sds_t tagfield tostruct flb_httptagparameter to config_mapprocess_pack_record()to usectx->tagas fallbackctx->taginhttp_config_destroy()Tests
flb_test_http_fixed_tag()test caseUsage Example
Testing
All unit tests pass successfully:
Backward Compatibility
✅ This change is fully backward compatible. Existing configurations will continue to work as before since the
tagparameter is optional and defaults toNULL.Checklist
in_http: description)Summary by CodeRabbit
New Features
Bug Fixes
Tests