Skip to content

filter_log_to_metrics: fix initialization and exception cleanup#11428

Merged
cosmo0920 merged 3 commits into4.2from
backport-11420-log-to-metrics
Feb 5, 2026
Merged

filter_log_to_metrics: fix initialization and exception cleanup#11428
cosmo0920 merged 3 commits into4.2from
backport-11420-log-to-metrics

Conversation

@edsiper
Copy link
Member

@edsiper edsiper commented Feb 4, 2026

Backport of #11420


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.

Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
@edsiper edsiper requested a review from cosmo0920 as a code owner February 4, 2026 16:56
@edsiper edsiper added this to the Fluent Bit v4.2.3 milestone Feb 4, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 4, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch backport-11420-log-to-metrics

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 and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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: e3b42f9864

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 742 to 745
if (ret == -1) {
flb_errno();
flb_plg_error(f_ins, "cannot initialize metrics emitter instance.");
log_to_metrics_destroy(ctx);
return -1;

Choose a reason for hiding this comment

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

P2 Badge Clean up emitter/context on init failure

When flb_input_instance_init (or later storage init) fails, cb_log_to_metrics_init now returns -1 without tearing down the partially created emitter instance or freeing the filter context. flb_filter_init_all only calls flb_filter_instance_destroy on init failure and never runs cb_exit, so those allocations (including the emitter input instance) leak for configs that hit this error path (e.g., invalid emitter setup or storage init failure). Consider restoring log_to_metrics_destroy(ctx) (or equivalent cleanup) on these failure returns.

Useful? React with 👍 / 👎.

@cosmo0920 cosmo0920 merged commit a1e82ab into 4.2 Feb 5, 2026
25 checks passed
@cosmo0920 cosmo0920 deleted the backport-11420-log-to-metrics branch February 5, 2026 01:46
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.

2 participants