Skip to content

Commit d07934d

Browse files
committed
Format span attributes in ai integrations so that the UI frontend can format them correctly
1 parent 9711b3b commit d07934d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sentry_sdk/ai/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import json
2+
13
from typing import TYPE_CHECKING
24

35
if TYPE_CHECKING:
46
from typing import Any
7+
from sentry_sdk.tracing import Span
58

6-
from sentry_sdk.tracing import Span
79
from sentry_sdk.utils import logger
810

911

@@ -33,4 +35,4 @@ def set_data_normalized(span, key, value, unpack=True):
3335
if isinstance(normalized, (int, float, bool, str)):
3436
span.set_data(key, normalized)
3537
else:
36-
span.set_data(key, str(normalized))
38+
span.set_data(key, json.dumps(normalized))

0 commit comments

Comments
 (0)