Skip to content

Commit 8694de8

Browse files
committed
opentelemetry: utils: fix checks for numeric attributes
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 9426aa0 commit 8694de8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/opentelemetry/flb_opentelemetry_utils.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,18 @@ int flb_otel_utils_json_payload_get_wrapped_value(msgpack_object *wrapper,
113113
}
114114
else if (strncasecmp(kv_key->ptr, "intValue", kv_key->size) == 0) {
115115
if (kv_value->type != MSGPACK_OBJECT_POSITIVE_INTEGER &&
116-
kv_value->type != MSGPACK_OBJECT_NEGATIVE_INTEGER) {
117-
/* If the value is not an integer, we cannot process it */
116+
kv_value->type != MSGPACK_OBJECT_NEGATIVE_INTEGER &&
117+
kv_value->type != MSGPACK_OBJECT_STR) {
118+
/* If the value is not an integer or string, we cannot process it */
118119
return -2;
119120
}
120121
internal_type = MSGPACK_OBJECT_POSITIVE_INTEGER;
121122
}
122123
else if (strncasecmp(kv_key->ptr, "doubleValue", kv_key->size) == 0) {
123124
if (kv_value->type != MSGPACK_OBJECT_FLOAT32 &&
124-
kv_value->type != MSGPACK_OBJECT_FLOAT64) {
125-
/* If the value is not a float, we cannot process it */
125+
kv_value->type != MSGPACK_OBJECT_FLOAT64 &&
126+
kv_value->type != MSGPACK_OBJECT_STR) {
127+
/* If the value is not a float or string, we cannot process it */
126128
return -2;
127129
}
128130
internal_type = MSGPACK_OBJECT_FLOAT;

0 commit comments

Comments
 (0)