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",