diff --git a/platform-includes/logs/best-practices/python.mdx b/platform-includes/logs/best-practices/python.mdx index 985fa2a1867f5..27a96143f925c 100644 --- a/platform-includes/logs/best-practices/python.mdx +++ b/platform-includes/logs/best-practices/python.mdx @@ -69,7 +69,8 @@ sentry_sdk.logger.info( # Business context "order_value": 149.99, - "feature_flags": ["new-checkout", "discount-v2"], + # Join lists into a string — array values aren't stored as attributes + "feature_flags": ",".join(["new-checkout", "discount-v2"]), } ) ``` diff --git a/platform-includes/logs/usage/python.mdx b/platform-includes/logs/usage/python.mdx index ff0e51f683cc4..ad073e66a0c60 100644 --- a/platform-includes/logs/usage/python.mdx +++ b/platform-includes/logs/usage/python.mdx @@ -30,3 +30,9 @@ sentry_sdk.logger.error( } ) ``` + + + +Attribute values should be primitives — strings, numbers, or booleans. Sentry's log storage only retains these scalar types, so other values are handled inconsistently. A `list` or `tuple` of same-typed scalars (for example `[1, 2, 3]`) is sent as an array, which is **not currently stored** and shows up empty in the Logs UI. Mixed lists and `dict`s are stored as their string representation. To keep a complex value searchable, serialize it to a string before logging, for example `json.dumps(workflow_ids)`. + +