Skip to content

Commit 848ee28

Browse files
committed
fix: Fix list attribute type
1 parent d2b7d5e commit 848ee28

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

sentry_sdk/utils.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,19 +2097,12 @@ def serialize_attribute(val: "AttributeValue") -> "SerializedAttributeValue":
20972097

20982098
if isinstance(val, list):
20992099
if not val:
2100-
return {"value": [], "type": "string[]"}
2100+
return {"value": [], "type": "array"}
21012101

21022102
# Only lists of elements of a single type are supported
2103-
list_types: 'dict[type, Literal["string[]", "integer[]", "double[]", "boolean[]"]]' = {
2104-
str: "string[]",
2105-
int: "integer[]",
2106-
float: "double[]",
2107-
bool: "boolean[]",
2108-
}
2109-
21102103
ty = type(val[0])
2111-
if ty in list_types and all(type(v) is ty for v in val):
2112-
return {"value": val, "type": list_types[ty]}
2104+
if all(isinstance(v, ty) for v in val):
2105+
return {"value": val, "type": "array"}
21132106

21142107
# Coerce to string if we don't know what to do with the value. This should
21152108
# never happen as we pre-format early in format_attribute, but let's be safe.

0 commit comments

Comments
 (0)