@@ -369,18 +369,23 @@ static int cb_ml_init(struct flb_filter_instance *ins,
369
369
"fluentbit" , "filter" , "emit_records_total" ,
370
370
"Total number of emitted records" ,
371
371
1 , (char * []) {"name" });
372
+
373
+ /* OLD api */
374
+ flb_metrics_add (FLB_MULTILINE_METRIC_EMITTED ,
375
+ "emit_records" , ctx -> ins -> metrics );
376
+ #endif
377
+ }
378
+ /* Truncated metrics always should be existing. */
379
+ #ifdef FLB_HAVE_METRICS
372
380
ctx -> cmt_truncated = cmt_counter_create (ins -> cmt ,
373
381
"fluentbit" , "filter" , "emit_truncated_total" ,
374
382
"Total number of truncated occurence of multiline" ,
375
383
1 , (char * []) {"name" });
376
384
377
385
/* OLD api */
378
- flb_metrics_add (FLB_MULTILINE_METRIC_EMITTED ,
379
- "emit_records" , ctx -> ins -> metrics );
380
386
flb_metrics_add (FLB_MULTILINE_METRIC_TRUNCATED ,
381
387
"emit_truncated" , ctx -> ins -> metrics );
382
388
#endif
383
- }
384
389
385
390
mk_list_init (& ctx -> ml_streams );
386
391
mk_list_init (& ctx -> split_message_packers );
@@ -846,16 +851,6 @@ static int cb_ml_filter(const void *data, size_t bytes,
846
851
flb_plg_debug (ctx -> ins ,
847
852
"could not append object from tag: %s" , tag );
848
853
}
849
- else if (ret == FLB_MULTILINE_OK ) {
850
- #ifdef FLB_HAVE_METRICS
851
- name = (char * ) flb_filter_name (ctx -> ins );
852
- ts = cfl_time_now ();
853
- cmt_counter_inc (ctx -> cmt_emitted , ts , 1 , (char * []) {name });
854
-
855
- /* old api */
856
- flb_metrics_sum (FLB_MULTILINE_METRIC_EMITTED , 1 , ctx -> ins -> metrics );
857
- #endif
858
- }
859
854
}
860
855
861
856
flb_log_event_decoder_destroy (& decoder );
0 commit comments