-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input_chunk: update records in the right place #8223
Conversation
In commit ac4ec1f, the input chunk writing was moved down from the previous spot to be below where input metrics are update. This PR moves the metric update below the input chunk write so that the `ret == CIO_OK` check is actually right, and so that the metrics are only updated after the write has occurred. I also moved adding to `total_records` outside of the metric ifdef. This appears to have been here for some time, but there are numerous output plugins that rely on `event_chunk->total_events`, which is set from this total_records value. This will mean it always gets updated, even if metrics are disabled. Signed-off-by: braydonk <[email protected]>
@leonardo-albertovich please review if you can to make sure this fix makes sense with your original commit. |
@@ -1499,31 +1499,6 @@ static int input_chunk_append_raw(struct flb_input_instance *in, | |||
flb_chunk_trace_do_input(ic); | |||
#endif /* FLB_HAVE_CHUNK_TRACE */ | |||
|
|||
/* Update 'input' metrics */ | |||
#ifdef FLB_HAVE_METRICS | |||
if (ret == CIO_OK) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When in this spot, this check would fail because the last time ret
is set is by a function that returns CIO_TRUE
. CIO_TRUE
is a !0
macro. CIO_OK
is 0, meaning this check would always fail when flb_chunk_is_up
or cio_chunk_up_force
succeeded.
`total_events` is expected to be set even in scenarios where `FLB_HAVE_METRICS` is not defined. Remove the guard around actually setting that value from the input chunk. Signed-off-by: braydonk <[email protected]>
Adds a test that checks whether the input chunk that was created during the test has a `total_records` value set. Signed-off-by: braydonk <[email protected]>
The macos jemalloc tests seem to be the same flakes that are always happening and are unrelated to the PR. |
Similarly to other spots, total_records is expected to be set in a few plugins outside of FLB_HAVE_METRICS definitions. This makes it so when this value is set on filter, it happens outside of the definition so that filters that change the size of total_records will still have the values reflected. Signed-off-by: braydonk <[email protected]>
thank you |
In commit ac4ec1f, the input chunk writing was moved down from the previous spot to be below where input metrics are updated. This PR moves the metric update below the input chunk write so that the
ret == CIO_OK
check is actually right, and so that the metrics are only updated after the write has occurred.I also moved adding to
total_records
outside of the metric ifdef. This appears to have been here for some time, but there are numerous output plugins that rely onevent_chunk->total_events
, which is set from this total_records value. This will mean it always gets updated, even if metrics are disabled.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:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
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.