Skip to content

Commit 070e761

Browse files
pwhelanedsiper
authored andcommitted
in_event_type: implement pause/resume to stop timed collector.
Signed-off-by: Phillip Whelan <[email protected]>
1 parent 9bfd593 commit 070e761

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

plugins/in_event_type/event_type.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct event_type {
4343

4444
int interval_sec;
4545
int interval_nsec;
46+
struct flb_input_instance *ins;
4647
};
4748

4849
static struct ctrace_id *create_random_span_id()
@@ -405,6 +406,7 @@ static int cb_event_type_init(struct flb_input_instance *ins,
405406
flb_errno();
406407
return -1;
407408
}
409+
ctx->ins = ins;
408410

409411
ret = flb_input_config_map_set(ins, (void *) ctx);
410412
if (ret == -1) {
@@ -451,6 +453,20 @@ static int cb_event_type_exit(void *data, struct flb_config *config)
451453
return 0;
452454
}
453455

456+
static void cb_event_type_pause(void *data, struct flb_config *config)
457+
{
458+
struct event_type *ctx = data;
459+
460+
flb_input_collector_pause(ctx->coll_fd, ctx->ins);
461+
}
462+
463+
static void cb_event_type_resume(void *data, struct flb_config *config)
464+
{
465+
struct event_type *ctx = data;
466+
467+
flb_input_collector_resume(ctx->coll_fd, ctx->ins);
468+
}
469+
454470
/* Configuration properties map */
455471
static struct flb_config_map config_map[] = {
456472
{
@@ -480,8 +496,8 @@ struct flb_input_plugin in_event_type_plugin = {
480496
.cb_pre_run = NULL,
481497
.cb_collect = NULL,
482498
.cb_flush_buf = NULL,
483-
.cb_pause = NULL,
484-
.cb_resume = NULL,
499+
.cb_pause = cb_event_type_pause,
500+
.cb_resume = cb_event_type_resume,
485501
.cb_exit = cb_event_type_exit,
486502
.config_map = config_map,
487503
.flags = FLB_INPUT_CORO | FLB_INPUT_THREADED

0 commit comments

Comments
 (0)