Skip to content

Commit 7ce0d16

Browse files
committed
router: add router context structure and move routing state
Replace config routing mask fields with router context pointer. Add router struct with mask state and metrics counters. Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
1 parent be2f2be commit 7ce0d16

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

include/fluent-bit/flb_router.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <fluent-bit/flb_config.h>
2929
#include <fluent-bit/flb_conditionals.h>
3030
#include <cfl/cfl.h>
31+
#include <cmetrics/cmetrics.h>
32+
#include <cmetrics/cmt_counter.h>
3133
#include <monkey/mk_core.h>
3234

3335
struct flb_mp_chunk_cobj;
@@ -47,6 +49,22 @@ struct flb_router_path {
4749
struct cfl_list _head;
4850
};
4951

52+
struct flb_router {
53+
/* Routing masks */
54+
size_t route_mask_size;
55+
size_t route_mask_slots;
56+
uint64_t *route_empty_mask;
57+
58+
/* metrics context */
59+
struct cmt *cmt;
60+
61+
/* logs routing metrics */
62+
struct cmt_counter *logs_records_total;
63+
struct cmt_counter *logs_bytes_total;
64+
struct cmt_counter *logs_drop_records_total;
65+
struct cmt_counter *logs_drop_bytes_total;
66+
};
67+
5068
static inline int flb_router_match_type(int in_event_type,
5169
struct flb_output_instance *o_ins)
5270
{
@@ -183,5 +201,9 @@ int flb_router_config_parse(struct flb_cf *cf,
183201
void flb_router_routes_destroy(struct cfl_list *input_routes);
184202
int flb_router_apply_config(struct flb_config *config);
185203

204+
int flb_router_metrics_create(struct flb_config *config, struct flb_router *router);
205+
struct flb_router *flb_router_create(struct flb_config *config);
206+
void flb_router_destroy(struct flb_router *router);
207+
186208
#endif
187209

0 commit comments

Comments
 (0)