in_prometheus_scrape: call flb_input_upstream_set to apply net.* config#12095
in_prometheus_scrape: call flb_input_upstream_set to apply net.* config#12095labros-mediaalpha wants to merge 1 commit into
Conversation
prom_scrape_context_create() calls flb_upstream_create() but never calls flb_input_upstream_set(), so net.* properties (including net.keepalive) are parsed but never applied to the plugin's upstream. Same fix already applied to in_kubernetes_events (fluent#11188) and in_calyptia_fleet (fluent#10998). Ref fluent#12094 Signed-off-by: Labros Chaidas <labros@mediaalpha.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Prometheus scrape plugin now binds its upstream to the input and cleans up the upstream and context if binding fails. ChangesPrometheus scrape upstream binding
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce8b8d7053
ℹ️ 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".
| return NULL; | ||
| } | ||
|
|
||
| if (flb_input_upstream_set(upstream, ins) != 0) { |
There was a problem hiding this comment.
Set the keepalive stream flag when applying net settings
When prometheus_scrape uses the default or explicit net.keepalive On, this call copies ins->net_setup.keepalive but leaves the upstream flags as the FLB_IO_TCP value created above. create_conn() initializes conn->recycle from flb_stream_is_keepalive(&u->base), so the connection is still destroyed on release and the new net.keepalive support remains ineffective; the input path needs the same keepalive flag update that output upstream setup performs before the upstream is used.
Useful? React with 👍 / 👎.
This PR description was AI-assisted (Claude Code).
What does this PR do?
Adds the missing
flb_input_upstream_set()call inin_prometheus_scrape, following the same pattern already merged forin_kubernetes_events(#11188) andin_calyptia_fleet(#10998).Note: this fix alone is not sufficient to restore connection reuse —
see #12094 and the companion PR against
flb_input_upstream_set()itself. Verified via packet capture that this change on its own produces
no observable difference; both PRs are needed together.
Screenshots
N/A (backend networking change, verified via tcpdump/debug log — see
linked issue)
Testing
Manually verified against a live instance running v5.0.7 + this patch:
loopback packet capture (
tcpdump -i lo) and-vvdebug logging, incombination with the companion core fix.
Ref #12094
Summary by CodeRabbit