Skip to content

Commit 8a8e805

Browse files
committed
opentelemetry: fix wrapping condition for array/maps
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 6ef7502 commit 8a8e805

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/opentelemetry/flb_opentelemetry_utils.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ int flb_otel_utils_json_payload_get_wrapped_value(msgpack_object *wrapper,
135135
internal_type = MSGPACK_OBJECT_BIN;
136136
}
137137
else if (strncasecmp(kv_key->ptr, "arrayValue", kv_key->size) == 0) {
138-
if (kv_value->type != MSGPACK_OBJECT_ARRAY) {
139-
/* If the value is not an array, we cannot process it */
138+
if (kv_value->type != MSGPACK_OBJECT_ARRAY &&
139+
kv_value->type != MSGPACK_OBJECT_MAP) {
140+
/* If the value is not an array or map, we cannot process it */
140141
return -2;
141142
}
142143
internal_type = MSGPACK_OBJECT_ARRAY;
@@ -233,7 +234,6 @@ int flb_otel_utils_json_payload_append_converted_value(
233234
target_field,
234235
(char *) object->via.str.ptr,
235236
object->via.str.size);
236-
237237
break;
238238
case MSGPACK_OBJECT_NIL:
239239
/* Append a null value */
@@ -262,7 +262,6 @@ int flb_otel_utils_json_payload_append_converted_value(
262262
encoder,
263263
target_field,
264264
object);
265-
266265
break;
267266
default:
268267
break;
@@ -375,11 +374,8 @@ int flb_otel_utils_json_payload_append_converted_map(
375374
object,
376375
&encoder_result);
377376

378-
if (result == 0 && encoder_result == FLB_EVENT_ENCODER_SUCCESS) {
379-
return result;
380-
}
381-
else if (result != 0) {
382-
return result;
377+
if (result == 0) {
378+
return encoder_result;
383379
}
384380

385381
result = flb_log_event_encoder_begin_map(encoder, target_field);

0 commit comments

Comments
 (0)