Skip to content

Commit 8b70738

Browse files
committed
plugin_proxy: enable event_type specification for proxy plugins
This commit adds event_type to the flb_plugin_proxy_def struct. This allows for the setting of event_type to a value other than the default log only initialization. In the flb_plugin_proxy_register function default behaviour is enforced by checking for unset event_type vlaues. When unset (a value of 0) then log behaviour is defaulted. No need for incorrect value checking since this was not a set field in the past. Unset fields are set as current behavior dicates and future usecases using incorrect values can be treated as user error. Input use case does not use event-type and is unaffected by this change. Signed-off-by: jmccormick7 <jcm258@case.edu>
1 parent 0def4e6 commit 8b70738

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

include/fluent-bit/flb_plugin_proxy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct flb_plugin_proxy_def {
4040
int flags;
4141
char *name; /* plugin short name */
4242
char *description; /* plugin description */
43+
int event_type; /* event type (logs/metrics/traces) */
4344
};
4445

4546
/* Proxy context */

src/flb_plugin_proxy.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,14 @@ static int flb_proxy_register_output(struct flb_plugin_proxy *proxy,
362362
out->flags = def->flags;
363363
out->name = flb_strdup(def->name);
364364

365+
/* If event_type is unset (0) then default to logs (this is the current behavior) */
366+
if (def->event_type == 0) {
367+
out->event_type = FLB_OUTPUT_LOGS;
368+
}
369+
else {
370+
out->event_type = def->event_type;
371+
}
372+
365373
out->description = def->description;
366374
mk_list_add(&out->_head, &config->out_plugins);
367375

@@ -396,6 +404,7 @@ static int flb_proxy_register_input(struct flb_plugin_proxy *proxy,
396404
in->flags = def->flags | FLB_INPUT_THREADED;
397405
in->name = flb_strdup(def->name);
398406
in->description = def->description;
407+
399408
mk_list_add(&in->_head, &config->in_plugins);
400409

401410
/*

0 commit comments

Comments
 (0)