input: added ring buffer registration for threaded plugins
@@ -46,8 +46,14 @@ struct flb_libco_in_params libco_in_param;
* Ring buffer size: we make space for 512 entries that each input instance can
* use to enqueue data. Note that this value is fixed and only affect input plugins
* which runs in threaded mode (separate thread)
+ *
+ * Ring buffer window: the current window size is set to 5% which means that the
+ * ring buffer will emit a flush request whenever there are 51 records or more
+ * awaiting to be consumed.
*/
+
#define FLB_INPUT_RING_BUFFER_SIZE (sizeof(void *) * 1024)
+#define FLB_INPUT_RING_BUFFER_WINDOW (5)
static int check_protocol(const char *prot, const char *output)
@@ -766,6 +772,15 @@ int flb_input_instance_init(struct flb_input_instance *ins,
flb_input_instance_destroy(ins);
return -1;
}
+
+ /* register the ring buffer */
+ ret = flb_ring_buffer_register(ins->rb, config->evl, FLB_INPUT_RING_BUFFER_WINDOW);
+ if (ret) {
+ flb_error("failed while registering ring buffer events on input %s",
+ ins->name);
+ flb_input_instance_destroy(ins);
+ return -1;
+ }
}
else {
/* initialize channel events */
