fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

input_chunk: fix input plugin metrics not counting records re-emitted by filters downstream

Open mindw opened this issue 1 year ago • 10 comments

move input metrics collections before applying filters.

Fixes #8729


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

Testing Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change
  • [N/A] Debug log output from testing the change
  • [N/A] Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • [x] Backport to latest stable release.

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.

mindw avatar Oct 13 '24 07:10 mindw

Should this be targeting the 3.0 or 3.1 branches? master is currently going to be the next 3.2 release: https://github.com/fluent/fluent-bit/wiki/Fluent-Bit-Roadmap

patrick-stephens avatar Oct 14 '24 09:10 patrick-stephens

@patrick-stephens not sure how backporting works in the project. Typically master is first followed by backport PRs.

mindw avatar Oct 14 '24 11:10 mindw

@patrick-stephens not sure how backporting works in the project. Typically master is first followed by backport PRs.

Yup, just trying to understand if this affects just 3.0.1 or more widely. I think you need to tick the backport checkbox then as well and ideally provide the related PRs for those backports.

patrick-stephens avatar Oct 14 '24 12:10 patrick-stephens

@patrick-stephens not sure how backporting works in the project. Typically master is first followed by backport PRs.

Yup, just trying to understand if this affects just 3.0.1 or more widely. I think you need to tick the backport checkbox then as well and ideally provide the related PRs for those backports.

This affects 2.2.0+. 2.1.10 was the last version without this bug.

mindw avatar Oct 14 '24 13:10 mindw

checking on this

edsiper avatar Oct 14 '24 16:10 edsiper

@braydonk would you please check this PR since it seems related to the change introduced in https://github.com/fluent/fluent-bit/commit/1a8dd39e3a26ddf06d479d2314b96d51faa0dec9 ?

edsiper avatar Oct 14 '24 16:10 edsiper

This bug was introduced by me in https://github.com/fluent/fluent-bit/pull/8223 and https://github.com/fluent/fluent-bit/pull/8229. Because of the way the multiline and rewrite_tag Filter plugins work, the input_records and input_bytes metrics would end up getting recorded only for the emitter plugins associated with each of those plugins and not the original input source.

The reason I did that at the time was that this commit https://github.com/fluent/fluent-bit/commit/ac4ec1fe8db8c6f240b40afccaeaab8751ea0e1d at a glance looked like metrics were supposed to be recorded after writing to the input chunk. However that was a mistaken interpretation on my part at the time, and the important detail was that metrics were recorded before filters were applied.

Thank you @mindw for catching this, sorry for the inconvenience.

braydonk avatar Oct 15 '24 14:10 braydonk

@braydonk @edsiper, thank you for the quick turn around. I believe the PRs' title should pass the checker.

mindw avatar Oct 16 '24 08:10 mindw

@braydonk , @edsiper as CI is green across the board. Is anything left for me to do here?

mindw avatar Oct 17 '24 06:10 mindw

Approving the PR is the extent of my authority, it's up to maintainers from here.

braydonk avatar Oct 17 '24 12:10 braydonk

@edsiper @braydonk it would be great to have this fix part the upcoming 3.2.0 release :)

mindw avatar Oct 26 '24 06:10 mindw

thanks everybody

edsiper avatar Oct 29 '24 13:10 edsiper