Skip to content

Commit d87d0f9

Browse files
committed
router: implement new router paths and conditions
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
1 parent 6345fd1 commit d87d0f9

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

include/fluent-bit/flb_router.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
#include <fluent-bit/flb_event.h>
2727
#include <fluent-bit/flb_sds.h>
2828
#include <fluent-bit/flb_config.h>
29+
#include <fluent-bit/flb_conditionals.h>
2930
#include <cfl/cfl.h>
3031
#include <monkey/mk_core.h>
3132

3233
struct flb_router_path {
3334
struct flb_output_instance *ins;
35+
struct flb_route *route;
3436
struct mk_list _head;
3537
};
3638

@@ -74,12 +76,17 @@ struct flb_route_condition_rule {
7476
flb_sds_t field;
7577
flb_sds_t op;
7678
flb_sds_t value;
79+
flb_sds_t *values;
80+
size_t values_count;
7781
struct cfl_list _head;
7882
};
7983

8084
struct flb_route_condition {
8185
struct cfl_list rules;
8286
int is_default;
87+
enum flb_condition_operator op;
88+
struct flb_condition *compiled;
89+
int compiled_status;
8390
};
8491

8592
struct flb_route_output {
@@ -136,6 +143,8 @@ int flb_condition_eval_metrics(struct flb_event_chunk *chunk,
136143
struct flb_route *route);
137144
int flb_condition_eval_traces(struct flb_event_chunk *chunk,
138145
struct flb_route *route);
146+
int flb_router_path_should_route(struct flb_event_chunk *chunk,
147+
struct flb_router_path *path);
139148

140149
struct flb_cf;
141150

src/flb_router.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ int flb_router_connect(struct flb_input_instance *in,
155155
}
156156

157157
p->ins = out;
158+
p->route = NULL;
158159
mk_list_add(&p->_head, &in->routes);
159160

160161
return 0;
@@ -172,6 +173,7 @@ int flb_router_connect_direct(struct flb_input_instance *in,
172173
}
173174

174175
p->ins = out;
176+
p->route = NULL;
175177
mk_list_add(&p->_head, &in->routes_direct);
176178

177179
return 0;

0 commit comments

Comments
 (0)