From e115c08d25bb7af5ec67fb73309985c788543cc0 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Tue, 21 Jan 2025 17:04:29 -0300 Subject: [PATCH] in_opentelemetry: add missing group footer when processing protobuf Signed-off-by: Eduardo Silva --- plugins/in_opentelemetry/opentelemetry_prot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/in_opentelemetry/opentelemetry_prot.c b/plugins/in_opentelemetry/opentelemetry_prot.c index a99ca12fb89..e49b65d1d46 100644 --- a/plugins/in_opentelemetry/opentelemetry_prot.c +++ b/plugins/in_opentelemetry/opentelemetry_prot.c @@ -588,6 +588,7 @@ static int binary_payload_to_msgpack(struct flb_opentelemetry *ctx, msgpack_pack_str(&mp_pck, 8); msgpack_pack_str_body(&mp_pck, "resource", 8); + /* resource header content */ flb_mp_map_header_init(&mh_tmp, &mp_pck); /* look for OTel resource attributes */ @@ -611,7 +612,7 @@ static int binary_payload_to_msgpack(struct flb_opentelemetry *ctx, msgpack_pack_uint64(&mp_pck, resource->dropped_attributes_count); } - + flb_mp_map_header_end(&mh_tmp); if (resource_log->schema_url) { flb_mp_map_header_append(&mh); @@ -1817,7 +1818,7 @@ static int process_payload_logs(struct flb_opentelemetry *ctx, struct http_conn struct mk_http_request *request) { struct flb_log_event_encoder *encoder; - int ret; + int ret = -1; encoder = flb_log_event_encoder_create(FLB_LOG_EVENT_FORMAT_FLUENT_BIT_V2); @@ -1825,6 +1826,7 @@ static int process_payload_logs(struct flb_opentelemetry *ctx, struct http_conn return -1; } + /* Check if the incoming payload is a valid JSON message and convert it to msgpack */ if (strncasecmp(request->content_type.data, "application/json",