Skip to content

Commit a54cab4

Browse files
common tests
1 parent 00733f9 commit a54cab4

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

tests/tracing/test_misc.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -611,11 +611,11 @@ class TestConversationIdPropagation:
611611
"""Tests for conversation_id propagation to AI spans."""
612612

613613
def test_conversation_id_propagates_to_span_with_gen_ai_operation_name(
614-
self, sentry_init, capture_items
614+
self, sentry_init, capture_events
615615
):
616616
"""Span with gen_ai.operation.name data should get conversation_id."""
617617
sentry_init(traces_sample_rate=1.0)
618-
items = capture_items("span")
618+
events = capture_events()
619619

620620
scope = sentry_sdk.get_current_scope()
621621
scope.set_conversation_id("conv-op-name-test")
@@ -624,16 +624,16 @@ def test_conversation_id_propagates_to_span_with_gen_ai_operation_name(
624624
with start_span(op="http.client") as span:
625625
span.set_data("gen_ai.operation.name", "chat")
626626

627-
spans = [item.payload for item in items if item.type == "span"]
628-
span_data = spans[0]["attributes"]
627+
(event,) = events
628+
span_data = event["spans"][0]["data"]
629629
assert span_data.get("gen_ai.conversation.id") == "conv-op-name-test"
630630

631631
def test_conversation_id_propagates_to_span_with_ai_op(
632-
self, sentry_init, capture_items
632+
self, sentry_init, capture_events
633633
):
634634
"""Span with ai.* op should get conversation_id."""
635635
sentry_init(traces_sample_rate=1.0)
636-
items = capture_items("span")
636+
events = capture_events()
637637

638638
scope = sentry_sdk.get_current_scope()
639639
scope.set_conversation_id("conv-ai-op-test")
@@ -642,8 +642,8 @@ def test_conversation_id_propagates_to_span_with_ai_op(
642642
with start_span(op="ai.chat.completions"):
643643
pass
644644

645-
spans = [item.payload for item in items if item.type == "span"]
646-
span_data = spans[0]["attributes"]
645+
(event,) = events
646+
span_data = event["spans"][0]["data"]
647647
assert span_data.get("gen_ai.conversation.id") == "conv-ai-op-test"
648648

649649
def test_conversation_id_propagates_to_span_with_gen_ai_op(

0 commit comments

Comments
 (0)