Skip to content

Commit f66cce8

Browse files
ref(anthropic): Remove set_data_normalized for string attributes
1 parent 963b4dd commit f66cce8

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

sentry_sdk/integrations/anthropic.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def _set_input_data(
247247
"""
248248
Set input data for the span based on the provided keyword arguments for the anthropic message creation.
249249
"""
250-
set_data_normalized(span, SPANDATA.GEN_AI_OPERATION_NAME, "chat")
250+
span.set_data(SPANDATA.GEN_AI_OPERATION_NAME, "chat")
251251
system_instructions: "Union[str, Iterable[TextBlockParam]]" = kwargs.get("system") # type: ignore
252252
messages = kwargs.get("messages")
253253
if (
@@ -317,9 +317,7 @@ def _set_input_data(
317317
span, SPANDATA.GEN_AI_REQUEST_MESSAGES, messages_data, unpack=False
318318
)
319319

320-
set_data_normalized(
321-
span, SPANDATA.GEN_AI_RESPONSE_STREAMING, kwargs.get("stream", False)
322-
)
320+
span.set_data(SPANDATA.GEN_AI_RESPONSE_STREAMING, kwargs.get("stream", False))
323321

324322
kwargs_keys_to_attributes = {
325323
"max_tokens": SPANDATA.GEN_AI_REQUEST_MAX_TOKENS,
@@ -332,14 +330,12 @@ def _set_input_data(
332330
value = kwargs.get(key)
333331

334332
if value is not None and _is_given(value):
335-
set_data_normalized(span, attribute, value)
333+
span.set_data(attribute, value)
336334

337335
# Input attributes: Tools
338336
tools = kwargs.get("tools")
339337
if tools is not None and _is_given(tools) and len(tools) > 0:
340-
set_data_normalized(
341-
span, SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS, safe_serialize(tools)
342-
)
338+
span.set_data(SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS, safe_serialize(tools))
343339

344340

345341
def _set_output_data(

0 commit comments

Comments
 (0)