Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions plugins/out_stdout/stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,24 +135,26 @@ static void print_traces_text(struct flb_output_instance *ins,
size_t off = 0;
cfl_sds_t text;
struct ctrace *ctr = NULL;
int ok = CTR_DECODE_MSGPACK_SUCCESS;

/* get cmetrics context */
ret = ctr_decode_msgpack_create(&ctr, (char *) data, bytes, &off);
if (ret != 0) {
flb_plg_error(ins, "could not process traces payload (ret=%i)", ret);
return;
}

/* convert to text representation */
text = ctr_encode_text_create(ctr);
/* Decode each ctrace context */
while ((ret = ctr_decode_msgpack_create(&ctr,
(char *) data,
bytes, &off)) == ok) {
/* convert to text representation */
text = ctr_encode_text_create(ctr);

/* destroy cmt context */
ctr_destroy(ctr);
/* destroy ctr context */
ctr_destroy(ctr);

printf("%s", text);
fflush(stdout);
printf("%s", text);
fflush(stdout);

ctr_encode_text_destroy(text);
ctr_encode_text_destroy(text);
}
if (ret != ok) {
flb_plg_debug(ins, "ctr decode msgpack returned : %d", ret);
}
}

static void cb_stdout_flush(struct flb_event_chunk *event_chunk,
Expand Down