Skip to content

feat(fluentbit): add flush interval options to the log_to_metrics filter - #2084

Merged
joshuabaird merged 2 commits into
fluent:masterfrom
cvas22:feat/1459-log-to-metrics-flush-interval
Oct 29, 2026
Merged

joshuabaird merged 2 commits into
fluent:masterfrom
cvas22:feat/1459-log-to-metrics-flush-interval

Conversation

@cvas22

@cvas22 cvas22 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds the flushIntervalSec and flushIntervalNsec options to the Fluent Bit logToMetrics filter (ClusterFilter and Filter). They're rendered as Fluent Bit's Flush_Interval_Sec and Flush_Interval_Nsec.

Without them, the filter emits metrics right after every matching record. #1459 reports this produces duplicate samples with the same timestamp and different values in Prometheus. With an interval set, metrics are emitted once per interval, which also lowers resource use under load.

Both fields are optional and validated as non-negative (flushIntervalNsec up to 999999999). When they aren't set nothing is rendered, so existing configs are unchanged.

filters:
  - logToMetrics:
      tag: metrics
      metricMode: counter
      metricName: count_all
      flushIntervalSec: 30

Which issue(s) this PR fixes:

Fixes #1459

Does this PR introduced a user-facing change?

The Fluent Bit logToMetrics filter supports flushIntervalSec and flushIntervalNsec.

Notes

I ran the generators (make generate manifests docs-update, in WSL with controller-gen v0.18.0) rather than editing generated files by hand. They updated the filter deepcopy, the filters CRDs (config, both charts, manifests/setup/setup.yaml) and docs/plugins/fluentbit/filter/log_to_metrics.md.

Tested locally: go test ./apis/... passes, including the new TestFilter_LogToMetrics_* cases (with and without the interval), and make lint reports 0 issues.

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
…etrics flush interval

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>

@joshuabaird joshuabaird left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for this. The changes follow the existing plugin patterns and the generated files look consistent.

One optional nit: it might be worth mentioning the 0-999999999 range in the flushIntervalNsec description so it shows up in the docs.

@joshuabaird
joshuabaird merged commit 3b19291 into fluent:master Oct 29, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: add flush_interval_sec

2 participants