Skip to content

Commit b956a77

Browse files
zshuang0316claude
andcommitted
input_log: count input metrics once for conditional route fan-out
split_and_append_route_payloads() appended one chunk copy per matching route through the metric-bearing append helpers, double counting the input records and bytes that are already accounted for by the unconditional append in input_log_append_processed_internal(). Use the new flags-aware append helpers with FLB_INPUT_CHUNK_SKIP_INPUT_METRICS for the per-route copies so the input-level totals reflect the original ingestion exactly once, regardless of how many routes match. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: zshuang0316 <zshuang0316@163.com>
1 parent bdb38ed commit b956a77

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/flb_input_log.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,18 +1397,27 @@ static int split_and_append_route_payloads(struct flb_input_instance *ins,
13971397
continue;
13981398
}
13991399

1400+
/*
1401+
* These appends are internal route copies of data that is also
1402+
* ingested by the unconditional append in
1403+
* input_log_append_processed_internal(). Suppress the input-level
1404+
* metrics here so fluentbit_input_records_total / _bytes_total are
1405+
* counted once for the original ingestion instead of once per route.
1406+
*/
14001407
if (local_append == FLB_TRUE) {
1401-
ret = flb_input_chunk_append_raw_local(ins,
1408+
ret = flb_input_chunk_append_raw_local_flags(ins,
14021409
FLB_INPUT_LOGS,
1410+
FLB_INPUT_CHUNK_SKIP_INPUT_METRICS,
14031411
payload->total_records,
14041412
payload->tag,
14051413
flb_sds_len(payload->tag),
14061414
payload->data,
14071415
payload->size);
14081416
}
14091417
else {
1410-
ret = flb_input_chunk_append_raw(ins,
1418+
ret = flb_input_chunk_append_raw_flags(ins,
14111419
FLB_INPUT_LOGS,
1420+
FLB_INPUT_CHUNK_SKIP_INPUT_METRICS,
14121421
payload->total_records,
14131422
payload->tag,
14141423
flb_sds_len(payload->tag),

0 commit comments

Comments
 (0)