From 4820a1f5d0b92f078b96161872824d7bf7564548 Mon Sep 17 00:00:00 2001 From: braydonk Date: Tue, 28 Nov 2023 16:11:01 +0000 Subject: [PATCH] filter: update total_records outside of ifdef 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 --- src/flb_filter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/flb_filter.c b/src/flb_filter.c index 485387c2ea7..8dfcf80ad02 100644 --- a/src/flb_filter.c +++ b/src/flb_filter.c @@ -123,11 +123,11 @@ void flb_filter_do(struct flb_input_chunk *ic, #ifdef FLB_HAVE_METRICS /* timestamp */ ts = cfl_time_now(); +#endif /* Count number of incoming records */ in_records = ic->added_records; pre_records = ic->total_records - in_records; -#endif /* Iterate filters */ mk_list_foreach(head, &config->filters) { @@ -201,10 +201,9 @@ void flb_filter_do(struct flb_input_chunk *ic, } #endif /* FLB_HAVE_CHUNK_TRACE */ - -#ifdef FLB_HAVE_METRICS ic->total_records = pre_records; +#ifdef FLB_HAVE_METRICS /* cmetrics */ cmt_counter_add(f_ins->cmt_drop_records, ts, in_records, 1, (char *[]) {name}); @@ -216,8 +215,9 @@ void flb_filter_do(struct flb_input_chunk *ic, break; } else { -#ifdef FLB_HAVE_METRICS out_records = flb_mp_count(out_buf, out_size); + +#ifdef FLB_HAVE_METRICS if (out_records > in_records) { diff = (out_records - in_records); @@ -240,11 +240,11 @@ void flb_filter_do(struct flb_input_chunk *ic, flb_metrics_sum(FLB_METRIC_N_DROPPED, diff, f_ins->metrics); } +#endif /* set number of records in new chunk */ in_records = out_records; ic->total_records = pre_records + in_records; -#endif } #ifdef FLB_HAVE_CHUNK_TRACE