Skip to content

Commit 4843674

Browse files
committed
update
1 parent 5e7d44b commit 4843674

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

sentry_sdk/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,4 +498,4 @@ def update_current_span(op=None, name=None, attributes=None):
498498
current_span.description = name
499499

500500
if attributes is not None:
501-
current_span.set_data(attributes)
501+
current_span.update_data(attributes)

sentry_sdk/tracing.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -599,25 +599,9 @@ def set_tag(self, key, value):
599599
# type: (str, Any) -> None
600600
self._tags[key] = value
601601

602-
def set_data(self, key=None, value=None):
603-
# type: (Optional[Union[str, Dict[str, Any]]], Optional[Any]) -> None
604-
"""Set data on the span.
605-
606-
Can be called in two ways:
607-
- set_data(key, value) - sets a single key-value pair
608-
- set_data({"key": "value"}) - sets multiple key-value pairs from a dict
609-
"""
610-
if key is None:
611-
return
612-
613-
if isinstance(key, dict):
614-
# Dictionary calling pattern: set_data({"key": "value"})
615-
for k, v in key.items():
616-
self._data[k] = v
617-
618-
elif isinstance(key, str):
619-
# Traditional calling pattern: set_data(key, value)
620-
self._data[key] = value
602+
def set_data(self, key, value):
603+
# type: (str, Any) -> None
604+
self._data[key] = value
621605

622606
def update_data(self, data):
623607
# type: (Dict[str, Any]) -> None
@@ -1292,8 +1276,8 @@ def set_tag(self, key, value):
12921276
# type: (str, Any) -> None
12931277
pass
12941278

1295-
def set_data(self, key=None, value=None):
1296-
# type: (Optional[Union[str, Dict[str, Any]]], Optional[Any]) -> None
1279+
def set_data(self, key, value):
1280+
# type: (str, Any) -> None
12971281
pass
12981282

12991283
def update_data(self, data):

sentry_sdk/tracing_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ def _set_input_attributes(span, template, send_pii, name, f, args, kwargs):
10161016
attributes[SPANDATA.GEN_AI_TOOL_DESCRIPTION] = docstring
10171017

10181018
attributes.update(_get_input_attributes(template, send_pii, args, kwargs))
1019-
span.set_data(attributes)
1019+
span.udpate_data(attributes)
10201020

10211021

10221022
def _set_output_attributes(span, template, send_pii, result):
@@ -1035,7 +1035,7 @@ def _set_output_attributes(span, template, send_pii, result):
10351035
attributes[SPANDATA.GEN_AI_TOOL_OUTPUT] = result
10361036

10371037
attributes.update(_get_output_attributes(template, send_pii, result))
1038-
span.set_data(attributes)
1038+
span.udpate_data(attributes)
10391039

10401040

10411041
def create_span_decorator(template, op=None, name=None, attributes=None):
@@ -1088,7 +1088,7 @@ async def async_wrapper(*args, **kwargs):
10881088
result = await f(*args, **kwargs)
10891089

10901090
_set_output_attributes(span, template, send_pii, result)
1091-
span.set_data(attributes)
1091+
span.udpate_data(attributes)
10921092

10931093
return result
10941094

@@ -1128,7 +1128,7 @@ def sync_wrapper(*args, **kwargs):
11281128
result = f(*args, **kwargs)
11291129

11301130
_set_output_attributes(span, template, send_pii, result)
1131-
span.set_data(attributes)
1131+
span.udpate_data(attributes)
11321132

11331133
return result
11341134

0 commit comments

Comments
 (0)