Skip to content

Commit ff9e156

Browse files
committed
filter: use new flb_mp_count() prototype
Signed-off-by: Eduardo Silva <[email protected]>
1 parent af8be66 commit ff9e156

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/flb_filter.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ void flb_filter_do(struct flb_input_chunk *ic,
7373
ssize_t write_at;
7474
struct mk_list *head;
7575
struct flb_filter_instance *f_ins;
76-
msgpack_zone *mp_zone = NULL;
77-
7876

7977
/* For the incoming Tag make sure to create a NULL terminated reference */
8078
ntag = flb_malloc(tag_len + 1);
@@ -90,9 +88,6 @@ void flb_filter_do(struct flb_input_chunk *ic,
9088
work_data = (const char *) data;
9189
work_size = bytes;
9290

93-
/* Count number of incoming records */
94-
mp_zone = msgpack_zone_new(MSGPACK_ZONE_CHUNK_SIZE);
95-
9691
/* Iterate filters */
9792
mk_list_foreach(head, &config->filters) {
9893
f_ins = mk_list_entry(head, struct flb_filter_instance, _head);
@@ -114,7 +109,7 @@ void flb_filter_do(struct flb_input_chunk *ic,
114109

115110
#ifdef FLB_HAVE_METRICS
116111
/* Count number of incoming records */
117-
in_records = flb_mp_count_zone(work_data, work_size, mp_zone);
112+
in_records = flb_mp_count(work_data, work_size);
118113
#endif
119114

120115
/* Invoke the filter callback */
@@ -138,14 +133,13 @@ void flb_filter_do(struct flb_input_chunk *ic,
138133
/* Summarize all records removed */
139134
flb_metrics_sum(FLB_METRIC_N_DROPPED,
140135
in_records, f_ins->metrics);
141-
msgpack_zone_clear(mp_zone);
142136
#endif
143137

144138
break;
145139
}
146140
else {
147141
#ifdef FLB_HAVE_METRICS
148-
out_records = flb_mp_count_zone(out_buf, out_size, mp_zone);
142+
out_records = flb_mp_count(out_buf, out_size);
149143
if (out_records > in_records) {
150144
diff = (out_records - in_records);
151145
/* Summarize new records */
@@ -160,8 +154,6 @@ void flb_filter_do(struct flb_input_chunk *ic,
160154
}
161155
#endif
162156
}
163-
msgpack_zone_clear(mp_zone);
164-
165157
ret = flb_input_chunk_write_at(ic, write_at,
166158
out_buf, out_size);
167159
if (ret == -1) {
@@ -182,7 +174,6 @@ void flb_filter_do(struct flb_input_chunk *ic,
182174
}
183175
}
184176

185-
msgpack_zone_free(mp_zone);
186177
flb_free(ntag);
187178
}
188179

0 commit comments

Comments
 (0)