Skip to content

Commit 204b980

Browse files
fix common tests
1 parent 06c2a40 commit 204b980

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

tests/tracing/test_decorator.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,9 @@ def my_agent():
364364

365365

366366
@pytest.mark.parametrize("send_default_pii", [True, False])
367-
def test_span_templates_ai_pii(sentry_init, capture_events, send_default_pii):
367+
def test_span_templates_ai_pii(sentry_init, capture_items, send_default_pii):
368368
sentry_init(traces_sample_rate=1.0, send_default_pii=send_default_pii)
369-
events = capture_events()
369+
items = capture_items("span")
370370

371371
@sentry_sdk.trace(template=SPANTEMPLATE.AI_TOOL)
372372
def my_tool(arg1, arg2, **kwargs):
@@ -396,15 +396,14 @@ def my_agent(*args, **kwargs):
396396
with sentry_sdk.start_transaction(name="test-transaction"):
397397
my_agent(22, 33, arg1=44, arg2=55)
398398

399-
(event,) = events
400-
(_, tool_span, _) = event["spans"]
399+
(_, tool_span, _) = (item.payload for item in items if item.type == "span")
401400

402401
if send_default_pii:
403402
assert (
404-
tool_span["data"]["gen_ai.tool.input"]
403+
tool_span["attributes"]["gen_ai.tool.input"]
405404
== "{'args': (1, 2), 'kwargs': {'tool_arg1': '3', 'tool_arg2': '4'}}"
406405
)
407-
assert tool_span["data"]["gen_ai.tool.output"] == "'tool_output'"
406+
assert tool_span["attributes"]["gen_ai.tool.output"] == "'tool_output'"
408407
else:
409-
assert "gen_ai.tool.input" not in tool_span["data"]
410-
assert "gen_ai.tool.output" not in tool_span["data"]
408+
assert "gen_ai.tool.input" not in tool_span["attributes"]
409+
assert "gen_ai.tool.output" not in tool_span["attributes"]

0 commit comments

Comments
 (0)