Skip to content

out_prometheus_exporter: apply HTTP server options#12111

Open
stondo wants to merge 2 commits into
fluent:masterfrom
stondo:fix/out-prometheus-exporter-http-options
Open

out_prometheus_exporter: apply HTTP server options#12111
stondo wants to merge 2 commits into
fluent:masterfrom
stondo:fix/out-prometheus-exporter-http-options

Conversation

@stondo

@stondo stondo commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Propagate buffer_chunk_size and workers from the parsed HTTP server configuration
when out_prometheus_exporter creates its embedded HTTP server.

The plugin already applies idle_timeout, buffer_max_size, and max_connections.
Omitting the other two parsed options makes valid configuration ineffective,
particularly http_server.workers.

Fixes #12110

Changes

  • apply http_server.buffer_chunk_size
  • apply http_server.workers
  • add a runtime regression test for both options

The test uses the actual Fluent Bit engine and verifies that:

configured chunk size == embedded server chunk size
embedded server workers == 2
embedded server runtime != NULL

It fails before the fix and passes afterward.

Compatibility

The default behavior is unchanged. The patch only makes explicitly configured HTTP
server options effective.

The same partial option propagation appears in out_vivo_exporter; this PR remains
scoped to the reproduced Prometheus exporter defect.

Testing

Example configuration:

pipeline:
  inputs:
    - name: fluentbit_metrics
      scrape_interval: 1

  outputs:
    - name: prometheus_exporter
      match: "*"
      host: 127.0.0.1
      port: 2021
      http_server.buffer_chunk_size: 64K
      http_server.workers: 2

Commands:

cmake -S . -B build-container-bookworm \
  -DFLB_TESTS_RUNTIME=On \
  -DFLB_TESTS_INTERNAL=On \
  -DFLB_EXAMPLES=Off \
  -DCMAKE_CXX_FLAGS=-mavx2
cmake --build build-container-bookworm -j8
ctest --test-dir build-container-bookworm \
  -R '^flb-rt-out_prometheus_exporter$' \
  --output-on-failure
ctest --test-dir build-container-bookworm \
  -R '^flb-it-http_server$' \
  --output-on-failure
FLUENT_BIT_BINARY="$PWD/build-container-bookworm/bin/fluent-bit" \
tests/integration/.venv/bin/python -m pytest \
  tests/integration/scenarios/out_prometheus_exporter/tests/test_out_prometheus_exporter_001.py \
  -q
FLUENT_BIT_BINARY="$PWD/build-container-bookworm/bin/fluent-bit" \
VALGRIND=1 VALGRIND_STRICT=1 \
  tests/integration/.venv/bin/python -m pytest \
  tests/integration/scenarios/out_prometheus_exporter/tests/test_out_prometheus_exporter_001.py \
  -q

These ran in the documented Debian 12 rootless Podman environment. The explicit AVX2
flag is a GCC 12 compatibility workaround for bundled simdutf, not part of this
change.

Results:

  • full YAML-enabled build: passed
  • runtime regression test: passed 10 consecutive iterations
  • HTTP server internal test: passed
  • normal integration: 2 passed
  • strict Valgrind integration: 2 passed
  • both Valgrind runs: 0 bytes live at exit, 0 errors
  • CI commit-prefix validation: passed
  • DCO: signed

Enter [N/A] in the box, if an item is not applicable to your change.

Testing

  • Example configuration file for the change
  • Debug/runtime output from testing the change
  • Valgrind output shows no leaks or memory corruption

Packaging

  • [N/A] No packaging or container-output change

Documentation

  • [N/A] Existing documented options are made effective; no new option is added

Backporting

  • Candidate for a separate 5.0 backport after the master change is accepted

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
    • Prometheus exporter now correctly applies configured HTTP server settings, including buffer chunk size and worker count.
  • Tests
    • Added a runtime test that validates the Prometheus exporter HTTP server’s configured buffer chunk size and worker threads.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ce15024f-1f54-4d69-b327-78e1e7641426

📥 Commits

Reviewing files that changed from the base of the PR and between 4c43d30 and 23f280e.

📒 Files selected for processing (3)
  • plugins/out_prometheus_exporter/prom_http.c
  • tests/runtime/CMakeLists.txt
  • tests/runtime/out_prometheus_exporter.c
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/runtime/CMakeLists.txt
  • tests/runtime/out_prometheus_exporter.c
  • plugins/out_prometheus_exporter/prom_http.c

📝 Walkthrough

Walkthrough

The Prometheus exporter now forwards configured HTTP server buffer and worker settings. A non-Windows runtime test starts the exporter and verifies the resulting server configuration and runtime initialization.

Changes

Prometheus HTTP options

Layer / File(s) Summary
Propagate HTTP server options
plugins/out_prometheus_exporter/prom_http.c
Passes configured buffer_chunk_size and workers values to the HTTP server options.
Validate runtime configuration
tests/runtime/out_prometheus_exporter.c, tests/runtime/CMakeLists.txt
Adds and registers a non-Windows runtime test that configures the exporter and verifies HTTP server options and runtime initialization.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: edsiper, cosmo0920

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: propagating HTTP server options in out_prometheus_exporter.
Linked Issues check ✅ Passed The patch propagates buffer_chunk_size and workers to the embedded HTTP server and adds a runtime test for the required checks.
Out of Scope Changes check ✅ Passed The changes stay focused on the Prometheus exporter fix and its regression test, with no unrelated features added.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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: 4c43d302a7

ℹ️ 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".

Comment thread tests/runtime/CMakeLists.txt Outdated
stondo added 2 commits July 19, 2026 22:46
Propagate buffer_chunk_size and workers from the parsed HTTP server
configuration when creating the exporter HTTP server.

Signed-off-by: Stefano Tondo <stondo@gmail.com>
Verify that the configured buffer chunk size and worker count reach the
embedded HTTP server and create a worker runtime.

Signed-off-by: Stefano Tondo <stondo@gmail.com>
@stondo
stondo force-pushed the fix/out-prometheus-exporter-http-options branch from 4c43d30 to 23f280e Compare July 19, 2026 20:51
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.

out_prometheus_exporter ignores HTTP server worker and buffer options

1 participant