@@ -1913,6 +1913,10 @@ static int append_to_ring_buffer(struct flb_input_instance *ins,
19131913 if (retries >= retry_limit ) {
19141914 flb_plg_error (ins , "could not enqueue records into the ring buffer" );
19151915 destroy_chunk_raw (cr );
1916+
1917+ /* update failed retries counter */
1918+ cmt_counter_add (ins -> cmt_ring_buffer_retry_failures , cfl_time_now (),
1919+ 1 , 1 , (char * []) {(char * ) flb_input_name (ins )});
19161920 return -1 ;
19171921 }
19181922
@@ -1922,12 +1926,22 @@ static int append_to_ring_buffer(struct flb_input_instance *ins,
19221926 flb_plg_debug (ins , "failed buffer write, retries=%i\n" ,
19231927 retries );
19241928
1929+ /* if the ring buffer is full, we need to retry, update the counters */
1930+ cmt_counter_add (ins -> cmt_ring_buffer_retries , cfl_time_now (),
1931+ 1 , 1 , (char * []) {(char * ) flb_input_name (ins )});
1932+
1933+
19251934 /* sleep for 100000 microseconds (100 milliseconds) */
19261935 usleep (100000 );
19271936 retries ++ ;
1937+
19281938 goto retry ;
19291939 }
19301940
1941+ /* update successful writes */
1942+ cmt_counter_add (ins -> cmt_ring_buffer_writes , cfl_time_now (),
1943+ 1 , 1 , (char * []) {(char * ) flb_input_name (ins )});
1944+
19311945 return 0 ;
19321946}
19331947
0 commit comments