From b71f4ff648e0145fa4d4ebc403025456288860e5 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Wed, 10 Jun 2026 08:55:18 +0200 Subject: [PATCH 1/5] test: Only capture relevant telemetry --- .../integrations/anthropic/test_anthropic.py | 36 ++++---- tests/integrations/django/test_basic.py | 2 +- .../google_genai/test_google_genai.py | 6 +- .../integrations/langchain/test_langchain.py | 2 +- .../integrations/langgraph/test_langgraph.py | 32 +++---- tests/integrations/litellm/test_litellm.py | 42 ++++----- tests/integrations/openai/test_openai.py | 2 +- .../pydantic_ai/test_pydantic_ai.py | 92 +++++++++---------- tests/integrations/rq/test_rq.py | 2 +- .../rust_tracing/test_rust_tracing.py | 14 +-- 10 files changed, 115 insertions(+), 115 deletions(-) diff --git a/tests/integrations/anthropic/test_anthropic.py b/tests/integrations/anthropic/test_anthropic.py index 7526e6ad3d..75606a1d35 100644 --- a/tests/integrations/anthropic/test_anthropic.py +++ b/tests/integrations/anthropic/test_anthropic.py @@ -3300,7 +3300,7 @@ def test_exception_message_create( ) if span_streaming: - items = capture_items("event", "transaction") + items = capture_items("event") with pytest.raises(AnthropicError): client.messages.create( @@ -3495,7 +3495,7 @@ async def test_exception_message_create_async( ) if span_streaming: - items = capture_items("event", "transaction") + items = capture_items("event") with pytest.raises(AnthropicError): await client.messages.create( @@ -3768,7 +3768,7 @@ def mock_messages_create(*args, **kwargs): test_messages = [test_message] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic tx"): client.messages.create( @@ -5064,7 +5064,7 @@ def test_system_prompt_with_complex_structure( ] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): response = client.messages.create( @@ -5420,7 +5420,7 @@ def test_message_with_url_image( ] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create(max_tokens=1024, messages=messages, model="model") @@ -5492,7 +5492,7 @@ def test_message_with_file_image( ] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create(max_tokens=1024, messages=messages, model="model") @@ -5608,7 +5608,7 @@ def test_message_with_url_pdf( ] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create(max_tokens=1024, messages=messages, model="model") @@ -5680,7 +5680,7 @@ def test_message_with_file_document( ] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create(max_tokens=1024, messages=messages, model="model") @@ -5910,7 +5910,7 @@ def test_binary_content_not_stored_when_pii_disabled( ] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create(max_tokens=1024, messages=messages, model="model") @@ -5974,7 +5974,7 @@ def test_binary_content_not_stored_when_prompts_disabled( ] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create(max_tokens=1024, messages=messages, model="model") @@ -6035,7 +6035,7 @@ def test_cache_tokens_nonstreaming( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create( @@ -6117,7 +6117,7 @@ def test_input_tokens_include_cache_write_nonstreaming( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create( @@ -6203,7 +6203,7 @@ def test_input_tokens_include_cache_read_nonstreaming( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create( @@ -6295,7 +6295,7 @@ def test_input_tokens_include_cache_read_streaming( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client._client, @@ -6398,7 +6398,7 @@ def test_stream_messages_input_tokens_include_cache_read_streaming( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client._client, @@ -6485,7 +6485,7 @@ def test_input_tokens_unchanged_without_caching( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="anthropic"): client.messages.create( @@ -6565,7 +6565,7 @@ def test_cache_tokens_streaming( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client._client, @@ -6663,7 +6663,7 @@ def test_stream_messages_cache_tokens( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client._client, diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index 4ffad98ad1..a05cf0095a 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -1629,7 +1629,7 @@ def test_does_not_capture_403( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("event", "transaction", "span") + items = capture_items("span") _, status, _ = unpack_werkzeug_response(client.get(reverse(endpoint))) assert status.lower() == "403 forbidden" diff --git a/tests/integrations/google_genai/test_google_genai.py b/tests/integrations/google_genai/test_google_genai.py index fb50c9cc7d..16c556031b 100644 --- a/tests/integrations/google_genai/test_google_genai.py +++ b/tests/integrations/google_genai/test_google_genai.py @@ -594,7 +594,7 @@ def test_error_handling( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming or stream_gen_ai_spans: - items = capture_items("event", "transaction") + items = capture_items("event") # Mock an error at the HTTP level with mock.patch.object( @@ -1800,7 +1800,7 @@ def test_embed_content_error_handling( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "event") + items = capture_items("event") # Mock an error at the HTTP level with mock.patch.object( @@ -2210,7 +2210,7 @@ async def test_async_embed_content_error_handling( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "event") + items = capture_items("event") # Mock an error at the HTTP level with mock.patch.object( diff --git a/tests/integrations/langchain/test_langchain.py b/tests/integrations/langchain/test_langchain.py index 6617f51103..14f57f0c0a 100644 --- a/tests/integrations/langchain/test_langchain.py +++ b/tests/integrations/langchain/test_langchain.py @@ -4149,7 +4149,7 @@ def test_langchain_embeddings_span_hierarchy( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("span") + items = capture_items("span", "transaction") # Mock the actual API call with mock.patch.object( diff --git a/tests/integrations/langgraph/test_langgraph.py b/tests/integrations/langgraph/test_langgraph.py index db41e0e8d7..b70afe598f 100644 --- a/tests/integrations/langgraph/test_langgraph.py +++ b/tests/integrations/langgraph/test_langgraph.py @@ -170,7 +170,7 @@ def original_compile(self, *args, **kwargs): return MockCompiledGraph(self.name) if stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with patch("sentry_sdk.integrations.langgraph.StateGraph"), start_transaction(): wrapped_compile = _wrap_state_graph_compile(original_compile) @@ -299,7 +299,7 @@ def original_invoke(self, *args, **kwargs): return {"messages": new_messages} if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(): wrapped_invoke = _wrap_pregel_invoke(original_invoke) @@ -485,7 +485,7 @@ async def run_test(): return result if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") result = asyncio.run(run_test()) assert result is not None @@ -610,7 +610,7 @@ def original_invoke(self, *args, **kwargs): raise Exception("Graph execution failed") if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(), pytest.raises( Exception, match="Graph execution failed" @@ -681,7 +681,7 @@ async def run_error_test(): await wrapped_ainvoke(pregel, test_state) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") asyncio.run(run_error_test()) @@ -792,7 +792,7 @@ def original_invoke(self, *args, **kwargs): return {"result": "test"} if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(): wrapped_invoke = _wrap_pregel_invoke(original_invoke) @@ -904,7 +904,7 @@ def original_invoke(self, *args, **kwargs): return {"messages": new_messages} if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(): wrapped_invoke = _wrap_pregel_invoke(original_invoke) @@ -1028,7 +1028,7 @@ async def run_test(): return result if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") result = asyncio.run(run_test()) assert result is not None @@ -1151,7 +1151,7 @@ def original_invoke(self, *args, **kwargs): return {"messages": new_messages} if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(): wrapped_invoke = _wrap_pregel_invoke(original_invoke) @@ -1274,7 +1274,7 @@ async def run_test(): return result if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") result = asyncio.run(run_test()) assert result is not None @@ -1374,7 +1374,7 @@ def original_invoke(self, *args, **kwargs): return {"messages": new_messages} if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(): wrapped_invoke = _wrap_pregel_invoke(original_invoke) @@ -1491,7 +1491,7 @@ async def run_test(): return result if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") result = asyncio.run(run_test()) assert result is not None @@ -1609,7 +1609,7 @@ def original_invoke(self, *args, **kwargs): return {"messages": new_messages} if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(): wrapped_invoke = _wrap_pregel_invoke(original_invoke) @@ -1737,7 +1737,7 @@ async def run_test(): return result if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") result = asyncio.run(run_test()) assert result is not None @@ -1881,7 +1881,7 @@ def original_invoke(self, *args, **kwargs): return {"messages": new_messages} if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(): wrapped_invoke = _wrap_pregel_invoke(original_invoke) @@ -1980,7 +1980,7 @@ def __init__(self, content, message_type="human"): pregel = MockPregelInstance(compiled_graph) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="langgraph tx"): # Use the wrapped invoke function directly diff --git a/tests/integrations/litellm/test_litellm.py b/tests/integrations/litellm/test_litellm.py index 831bb90b13..b859dd1222 100644 --- a/tests/integrations/litellm/test_litellm.py +++ b/tests/integrations/litellm/test_litellm.py @@ -618,7 +618,7 @@ async def test_async_streaming_chat_completion( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -722,7 +722,7 @@ def test_embeddings_create( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.embeddings._client._client, @@ -843,7 +843,7 @@ async def test_async_embeddings_create( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.embeddings._client._client, @@ -960,7 +960,7 @@ def test_embeddings_create_with_list_input( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.embeddings._client._client, @@ -1074,7 +1074,7 @@ async def test_async_embeddings_create_with_list_input( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.embeddings._client._client, @@ -1188,7 +1188,7 @@ def test_embeddings_no_pii( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.embeddings._client._client, @@ -1288,7 +1288,7 @@ async def test_async_embeddings_no_pii( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.embeddings._client._client, @@ -1538,7 +1538,7 @@ def test_span_origin( request_headers={"X-Stainless-Raw-Response": "true"}, ) if span_streaming: - items = capture_items("span") + items = capture_items("span", "transaction") with mock.patch.object( client.completions._client._client, @@ -1645,7 +1645,7 @@ def test_multiple_providers( ) if span_streaming: - items = capture_items("span") + items = capture_items("span", "transaction") with mock.patch.object( openai_client.completions._client._client, @@ -1713,7 +1713,7 @@ def test_multiple_providers( # The provider should be detected by litellm.get_llm_provider assert SPANDATA.GEN_AI_SYSTEM in span["attributes"] elif stream_gen_ai_spans: - items = capture_items("transaction") + items = capture_items("span", "transaction") with mock.patch.object( openai_client.completions._client._client, @@ -2077,7 +2077,7 @@ def test_additional_parameters( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -2191,7 +2191,7 @@ async def test_async_additional_parameters( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -2306,7 +2306,7 @@ def test_no_integration( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -2396,7 +2396,7 @@ async def test_async_no_integration( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -2479,7 +2479,7 @@ def test_response_without_usage( )() if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with start_transaction(name="litellm test"): kwargs = { @@ -2655,7 +2655,7 @@ def test_binary_content_encoding_image_url( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -2780,7 +2780,7 @@ async def test_async_binary_content_encoding_image_url( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -2908,7 +2908,7 @@ def test_binary_content_encoding_mixed_content( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -3022,7 +3022,7 @@ async def test_async_binary_content_encoding_mixed_content( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -3136,7 +3136,7 @@ def test_binary_content_encoding_uri_type( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, "send", @@ -3254,7 +3254,7 @@ async def test_async_binary_content_encoding_uri_type( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with mock.patch.object( client.completions._client._client, diff --git a/tests/integrations/openai/test_openai.py b/tests/integrations/openai/test_openai.py index dc2a046fa7..e37920628f 100644 --- a/tests/integrations/openai/test_openai.py +++ b/tests/integrations/openai/test_openai.py @@ -2274,7 +2274,7 @@ def test_span_status_error( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("event", "transaction", "span") + items = capture_items("event", "span") with start_transaction(name="test"): client = OpenAI(api_key="z") diff --git a/tests/integrations/pydantic_ai/test_pydantic_ai.py b/tests/integrations/pydantic_ai/test_pydantic_ai.py index 9d84c24c71..5a834f633a 100644 --- a/tests/integrations/pydantic_ai/test_pydantic_ai.py +++ b/tests/integrations/pydantic_ai/test_pydantic_ai.py @@ -94,7 +94,7 @@ async def test_agent_run_async( test_agent = get_test_agent() if span_streaming: - items = capture_items("span") + items = capture_items("span", "transaction") result = await test_agent.run( ["Message demonstrating the absence of truncation.", "Test input"] @@ -262,7 +262,7 @@ def failing_model(messages, info): assert spans[0]["status"] == "error" elif stream_gen_ai_spans: - items = capture_items("event", "transaction", "span") + items = capture_items("event", "span") with pytest.raises(RuntimeError, match="model exploded"): await agent.run("Test input") @@ -314,7 +314,7 @@ def test_agent_run_sync( test_agent = get_test_agent() if span_streaming: - items = capture_items("span") + items = capture_items("span", "transaction") result = test_agent.run_sync( ["Message demonstrating the absence of truncation.", "Test input"] @@ -428,7 +428,7 @@ def failing_model(messages, info): assert spans[0]["status"] == "error" elif stream_gen_ai_spans: - items = capture_items("event", "transaction", "span") + items = capture_items("event", "span") with pytest.raises(RuntimeError, match="model exploded"): agent.run_sync("Test input") @@ -480,7 +480,7 @@ async def test_agent_run_stream( test_agent = get_test_agent() if span_streaming: - items = capture_items("span") + items = capture_items("span", "transaction") async with test_agent.run_stream( ["Message demonstrating the absence of truncation.", "Test input"] @@ -633,7 +633,7 @@ async def test_agent_run_stream_events( test_agent = get_test_agent() if span_streaming: - items = capture_items("span") + items = capture_items("span", "transaction") if PYDANTIC_AI_VERSION > (2,): async with test_agent.run_stream_events( @@ -747,7 +747,7 @@ def add_numbers(a: int, b: int) -> int: return a + b if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") result = await test_agent.run("What is 5 + 3?") @@ -863,7 +863,7 @@ def add_numbers(a: int, b: int) -> float: return a + b if span_streaming or stream_gen_ai_spans: - items = capture_items("event", "transaction", "span") + items = capture_items("event", "span") result = await test_agent.run("What is 5 + 3?") @@ -1000,7 +1000,7 @@ def add_numbers(a: Annotated[int, Field(gt=0, lt=0)], b: int) -> int: return a + b if span_streaming or stream_gen_ai_spans: - items = capture_items("event", "transaction", "span") + items = capture_items("event", "span") result = None with pytest.raises(UnexpectedModelBehavior): @@ -1124,7 +1124,7 @@ def multiply(a: int, b: int) -> int: return a * b if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") async with test_agent.run_stream("What is 7 times 8?") as result: async for _ in result.stream_output(): @@ -1207,7 +1207,7 @@ async def test_model_settings( test_agent_with_settings = get_test_agent_with_settings() if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await test_agent_with_settings.run("Test input") @@ -1283,7 +1283,7 @@ async def test_system_prompt_attribute( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await agent.run("Hello") @@ -1364,7 +1364,7 @@ async def test_error_handling( ) if span_streaming: - items = capture_items("span") + items = capture_items("transaction") # Simple run that should succeed await agent.run("Hello") @@ -1375,7 +1375,7 @@ async def test_error_handling( assert spans[1]["is_segment"] is True assert spans[1]["status"] != "error" # Could be None or some other status elif stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("transaction") # Simple run that should succeed await agent.run("Hello") @@ -1426,7 +1426,7 @@ async def test_without_pii( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") test_agent = get_test_agent() await test_agent.run("Sensitive input") @@ -1491,7 +1491,7 @@ def sensitive_tool(data: str) -> str: return f"Processed: {data}" if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await test_agent.run("Use sensitive tool with private data") @@ -1553,7 +1553,7 @@ async def run_agent(input_text): return await test_agent.run(input_text) if span_streaming: - items = capture_items("span") + items = capture_items("transaction") # Run 3 agents concurrently results = await asyncio.gather(*[run_agent(f"Input {i}") for i in range(3)]) @@ -1567,7 +1567,7 @@ async def run_agent(input_text): continue assert span["name"] == "invoke_agent test_agent" elif stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("transaction") # Run 3 agents concurrently results = await asyncio.gather(*[run_agent(f"Input {i}") for i in range(3)]) @@ -1636,7 +1636,7 @@ async def test_message_history( ] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") # First message await agent.run("Hello, I'm Alice") @@ -1703,7 +1703,7 @@ async def test_gen_ai_system( test_agent = get_test_agent() if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await test_agent.run("Test input") @@ -1763,7 +1763,7 @@ async def test_include_prompts_false( test_agent = get_test_agent() if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await test_agent.run("Sensitive prompt") @@ -1821,7 +1821,7 @@ async def test_include_prompts_true( test_agent = get_test_agent() if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await test_agent.run("Test prompt") @@ -1884,7 +1884,7 @@ def test_tool(value: int) -> int: return value * 2 if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await test_agent.run("Use the test tool with value 5") @@ -1944,7 +1944,7 @@ async def test_include_prompts_requires_pii( test_agent = get_test_agent() if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await test_agent.run("Test prompt") @@ -2162,7 +2162,7 @@ async def test_invoke_agent_with_list_user_prompt( ) if span_streaming: - items = capture_items("span") + items = capture_items("transaction") # Use a list as user prompt await agent.run(["First part", "Second part"]) @@ -2175,7 +2175,7 @@ async def test_invoke_agent_with_list_user_prompt( assert "First part" in messages_str assert "Second part" in messages_str elif stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("transaction") # Use a list as user prompt await agent.run(["First part", "Second part"]) @@ -2253,7 +2253,7 @@ async def test_invoke_agent_with_instructions( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await agent.run("Test input") @@ -2419,7 +2419,7 @@ async def test_usage_data_partial( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await agent.run("Test input") @@ -2474,7 +2474,7 @@ async def test_agent_data_from_scope( ) if span_streaming: - items = capture_items("span") + items = capture_items("transaction") # The integration automatically sets agent in scope during execution await agent.run("Test input") @@ -2484,7 +2484,7 @@ async def test_agent_data_from_scope( assert spans[1]["name"] == "invoke_agent test_scope_agent" elif stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("transaction") # The integration automatically sets agent in scope during execution await agent.run("Test input") @@ -2536,7 +2536,7 @@ def tool_without_desc(x: int) -> int: return x * 2 if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await test_agent.run("Use the tool with 5") @@ -2597,7 +2597,7 @@ def calc_tool(value: int) -> int: return value + 10 if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await test_agent.run("Use calc_tool with 5") @@ -2676,7 +2676,7 @@ async def test_message_formatting_with_different_parts( ] if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await agent.run("What did I say?", message_history=history) @@ -2795,7 +2795,7 @@ async def test_agent_without_name( ) if span_streaming: - items = capture_items("span") + items = capture_items("transaction") await agent.run("Test input") @@ -2804,7 +2804,7 @@ async def test_agent_without_name( assert "invoke_agent" in spans[1]["name"] elif stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("transaction") await agent.run("Test input") @@ -3011,7 +3011,7 @@ def test_tool(x: int) -> int: ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") # Run with history containing tool return await agent.run("Use test_tool with 5") @@ -3958,7 +3958,7 @@ async def test_binary_content_encoding_image( ) if span_streaming: - items = capture_items("span") + items = capture_items("transaction") with sentry_sdk.traces.start_span( name="test", attributes={"sentry.op": "test"} @@ -3984,7 +3984,7 @@ async def test_binary_content_encoding_image( messages_data = _get_messages_from_span(span_data) assert _find_binary_content(messages_data, "image", "image/png") elif stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("transaction") with sentry_sdk.start_transaction(op="test", name="test"): span = sentry_sdk.start_span(op="test_span") @@ -4045,7 +4045,7 @@ async def test_binary_content_encoding_mixed_content( ) if span_streaming: - items = capture_items("span") + items = capture_items("transaction") with sentry_sdk.traces.start_span( name="test", attributes={"sentry.op": "test"} @@ -4082,7 +4082,7 @@ async def test_binary_content_encoding_mixed_content( assert found_text, "Text content should be found" assert _find_binary_content(messages_data, "image", "image/jpeg") elif stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("transaction") with sentry_sdk.start_transaction(op="test", name="test"): span = sentry_sdk.start_span(op="test_span") @@ -4171,7 +4171,7 @@ async def test_binary_content_in_agent_run( ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await agent.run(["Analyze this image:", binary_content]) @@ -4225,7 +4225,7 @@ async def test_set_usage_data_with_cache_tokens( ) if span_streaming: - items = capture_items("span") + items = capture_items("transaction") with sentry_sdk.traces.start_span( name="test", attributes={"sentry.op": "test"} @@ -4250,7 +4250,7 @@ async def test_set_usage_data_with_cache_tokens( spans[0]["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS_CACHE_WRITE] == 20 ) elif stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("transaction") with sentry_sdk.start_transaction(op="test", name="test"): span = sentry_sdk.start_span(op="test_span") @@ -4352,7 +4352,7 @@ def test_image_url_base64_content_in_span( found_image = False if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") with sentry_sdk.start_transaction(op="test", name="test"): image_url = ImageUrl(url=url, **image_url_kwargs) @@ -4463,7 +4463,7 @@ async def test_invoke_agent_image_url( image_url = ImageUrl(url=url, **image_url_kwargs) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") await agent.run([image_url, "Describe this image"]) @@ -4539,7 +4539,7 @@ def multiply_numbers(a: int, b: int) -> int: ) if span_streaming or stream_gen_ai_spans: - items = capture_items("transaction", "span") + items = capture_items("span") result = await agent.run("What is 5 times 3?") assert result is not None diff --git a/tests/integrations/rq/test_rq.py b/tests/integrations/rq/test_rq.py index 9b82a31110..b32a60fd63 100644 --- a/tests/integrations/rq/test_rq.py +++ b/tests/integrations/rq/test_rq.py @@ -291,7 +291,7 @@ def test_tracing_enabled( worker = rq.SimpleWorker([queue], connection=queue.connection) if span_streaming: - items = capture_items("event", "span") + items = capture_items("span") with sentry_sdk.traces.start_span( name="custom parent", diff --git a/tests/integrations/rust_tracing/test_rust_tracing.py b/tests/integrations/rust_tracing/test_rust_tracing.py index 743ad1729d..dcd79dcc1a 100644 --- a/tests/integrations/rust_tracing/test_rust_tracing.py +++ b/tests/integrations/rust_tracing/test_rust_tracing.py @@ -83,7 +83,7 @@ def test_on_new_span_on_close( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("event", "transaction", "span") + items = capture_items("span") with sentry_sdk.traces.start_span(name="custom parent"): rust_tracing.new_span(RustTracingLevel.Info, 3) @@ -169,7 +169,7 @@ def test_nested_on_new_span_on_close( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("event", "transaction", "span") + items = capture_items("span") with sentry_sdk.traces.start_span(name="custom parent"): original_sentry_span = sentry_sdk.traces.get_current_span() @@ -343,7 +343,7 @@ def test_on_event_exception( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("event", "transaction", "span") + items = capture_items("event") sentry_sdk.get_isolation_scope().clear_breadcrumbs() with sentry_sdk.traces.start_span(name="custom parent"): @@ -403,7 +403,7 @@ def test_on_event_breadcrumb( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("event", "transaction", "span") + items = capture_items("event") sentry_sdk.get_isolation_scope().clear_breadcrumbs() with sentry_sdk.traces.start_span(name="custom parent"): @@ -458,7 +458,7 @@ def test_on_event_event( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("event", "transaction", "span") + items = capture_items("event") sentry_sdk.get_isolation_scope().clear_breadcrumbs() with sentry_sdk.traces.start_span(name="custom parent"): @@ -518,7 +518,7 @@ def test_on_event_ignored( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("event", "transaction", "span") + items = capture_items("span") sentry_sdk.get_isolation_scope().clear_breadcrumbs() with sentry_sdk.traces.start_span(name="custom parent"): @@ -578,7 +578,7 @@ def span_filter(metadata: Dict[str, object]) -> bool: _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("event", "transaction", "span") + items = capture_items("span") with sentry_sdk.traces.start_span(name="custom parent"): original_sentry_span = sentry_sdk.traces.get_current_span() From f20a4cf883657e20bc759470dee425a2265edf2d Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Wed, 10 Jun 2026 08:58:27 +0200 Subject: [PATCH 2/5] test: Remove unnecessary filter clauses --- .../integrations/anthropic/test_anthropic.py | 16 +++---- tests/integrations/boto3/test_s3.py | 10 ++-- tests/integrations/django/asgi/test_asgi.py | 10 ++-- tests/integrations/django/test_basic.py | 18 +++---- .../integrations/django/test_cache_module.py | 28 +++++------ .../integrations/django/test_db_query_data.py | 20 ++++---- .../django/test_db_transactions.py | 24 +++++----- tests/integrations/django/test_tasks.py | 8 ++-- .../google_genai/test_google_genai.py | 14 +++--- tests/integrations/grpc/test_grpc_aio.py | 6 +-- .../integrations/langchain/test_langchain.py | 28 +++++------ .../integrations/langgraph/test_langgraph.py | 30 ++++++------ tests/integrations/litellm/test_litellm.py | 48 ++++++++----------- tests/integrations/openai/test_openai.py | 8 ++-- .../pydantic_ai/test_pydantic_ai.py | 48 +++++++++---------- tests/integrations/rq/test_rq.py | 4 +- .../rust_tracing/test_rust_tracing.py | 8 ++-- .../sqlalchemy/test_sqlalchemy.py | 20 ++++---- tests/integrations/stdlib/test_httplib.py | 6 +-- tests/integrations/stdlib/test_subprocess.py | 2 +- 20 files changed, 174 insertions(+), 182 deletions(-) diff --git a/tests/integrations/anthropic/test_anthropic.py b/tests/integrations/anthropic/test_anthropic.py index 75606a1d35..af8657e041 100644 --- a/tests/integrations/anthropic/test_anthropic.py +++ b/tests/integrations/anthropic/test_anthropic.py @@ -5074,7 +5074,7 @@ def test_system_prompt_with_complex_structure( assert response == EXAMPLE_MESSAGE sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 1 (span,) = spans @@ -5426,7 +5426,7 @@ def test_message_with_url_image( client.messages.create(max_tokens=1024, messages=messages, model="model") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (span,) = spans stored_messages = json.loads( @@ -5498,7 +5498,7 @@ def test_message_with_file_image( client.messages.create(max_tokens=1024, messages=messages, model="model") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (span,) = spans stored_messages = json.loads( @@ -5614,7 +5614,7 @@ def test_message_with_url_pdf( client.messages.create(max_tokens=1024, messages=messages, model="model") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (span,) = spans stored_messages = json.loads( @@ -5686,7 +5686,7 @@ def test_message_with_file_document( client.messages.create(max_tokens=1024, messages=messages, model="model") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (span,) = spans stored_messages = json.loads( @@ -5916,7 +5916,7 @@ def test_binary_content_not_stored_when_pii_disabled( client.messages.create(max_tokens=1024, messages=messages, model="model") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (span,) = spans # Messages should not be stored @@ -5980,7 +5980,7 @@ def test_binary_content_not_stored_when_prompts_disabled( client.messages.create(max_tokens=1024, messages=messages, model="model") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (span,) = spans # Messages should not be stored @@ -6213,7 +6213,7 @@ def test_input_tokens_include_cache_read_nonstreaming( ) sentry_sdk.flush() - (span,) = [item.payload for item in items if item.type == "span"] + (span,) = [item.payload for item in items] # input_tokens should be total: 19 (non-cached) + 2846 (cache_read) = 2865 assert span["attributes"][SPANDATA.GEN_AI_USAGE_INPUT_TOKENS] == 2865 diff --git a/tests/integrations/boto3/test_s3.py b/tests/integrations/boto3/test_s3.py index 35c6edbc05..8bdfce4223 100644 --- a/tests/integrations/boto3/test_s3.py +++ b/tests/integrations/boto3/test_s3.py @@ -47,7 +47,7 @@ def test_basic( span.end() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 2 span = spans[0] assert span["attributes"]["sentry.op"] == "http.client" @@ -102,7 +102,7 @@ def test_streaming( span.end() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 3 span1 = spans[0] @@ -196,7 +196,7 @@ def test_streaming_close( span.end() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 3 span1 = spans[0] assert span1["attributes"]["sentry.op"] == "http.client" @@ -258,7 +258,7 @@ def test_omit_url_data_if_parsing_fails( span.end() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[0]["attributes"] == ApproxDict( { "http.request.method": "GET", @@ -334,7 +334,7 @@ def test_span_origin( _ = [obj for obj in bucket.objects.all()] sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[1]["attributes"]["sentry.origin"] == "manual" assert spans[0]["attributes"]["sentry.origin"] == "auto.http.boto3" diff --git a/tests/integrations/django/asgi/test_asgi.py b/tests/integrations/django/asgi/test_asgi.py index cc69de8ea1..4e9eb95556 100644 --- a/tests/integrations/django/asgi/test_asgi.py +++ b/tests/integrations/django/asgi/test_asgi.py @@ -235,7 +235,7 @@ async def test_active_thread_id( data = json.loads(response["body"]) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["is_segment"] is False: @@ -393,7 +393,7 @@ async def test_async_middleware_spans( assert response["status"] == 200 sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Filter out signal-receiver spans — their ordering depends on Django # module import order and is not what this middleware test verifies. @@ -911,7 +911,7 @@ async def test_async_view( await comm.wait() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[5]["name"] == "/simple_async_view" else: events = capture_events() @@ -961,7 +961,7 @@ async def test_transaction_http_method_default( await comm.wait() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[5]["attributes"]["http.request.method"] == "GET" else: events = capture_events() @@ -1025,7 +1025,7 @@ async def test_transaction_http_method_custom( await comm.wait() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[10]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "OPTIONS" assert spans[16]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "HEAD" diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index a05cf0095a..b2b2152dc3 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -807,7 +807,7 @@ def test_response_trace( assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert ( '- sentry.op="view.response.render": name="serialize response"' @@ -1022,7 +1022,7 @@ def test_django_connect_trace( assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db": @@ -1138,7 +1138,7 @@ def test_db_connection_span_data( assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db": @@ -1448,7 +1448,7 @@ def test_template_tracing_meta( content, _, _ = unpack_werkzeug_response(client.get(reverse("template_test3"))) rendered_meta = content.decode("utf-8") - events = [item.payload for item in items if item.type == "event"] + events = [item.payload for item in items] else: events = capture_events() @@ -1677,7 +1677,7 @@ def test_render_spans( items = capture_items("span") client.get(url) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert expected_line in render_span_tree(spans) else: views_tests = [ @@ -2000,7 +2000,7 @@ def test_signals_spans_filtering( client.get(reverse("send_myapp_custom_signal")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert ( render_span_tree(spans) == """\ @@ -2242,7 +2242,7 @@ def test_span_origin( client.get(reverse("view_with_signal")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[-1]["attributes"]["sentry.origin"] == "auto.http.django" @@ -2291,7 +2291,7 @@ def test_transaction_http_method_default( client.head("/nomessage") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[2]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "GET" else: @@ -2335,7 +2335,7 @@ def test_transaction_http_method_custom( client.head("/nomessage") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[4]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "OPTIONS" assert spans[7]["attributes"][SPANDATA.HTTP_REQUEST_METHOD] == "HEAD" diff --git a/tests/integrations/django/test_cache_module.py b/tests/integrations/django/test_cache_module.py index c527d24589..8db7993700 100644 --- a/tests/integrations/django/test_cache_module.py +++ b/tests/integrations/django/test_cache_module.py @@ -119,7 +119,7 @@ def test_cache_spans_disabled_middleware( client.get(reverse("not_cached_view")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 2 else: events = capture_events() @@ -162,7 +162,7 @@ def test_cache_spans_disabled_decorator( client.get(reverse("cached_view")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 2 else: events = capture_events() @@ -205,7 +205,7 @@ def test_cache_spans_disabled_templatetag( client.get(reverse("view_with_cached_template_fragment")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 2 else: events = capture_events() @@ -250,7 +250,7 @@ def test_cache_spans_middleware( client.get(reverse("not_cached_view")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # first_event - cache.get assert spans[0]["attributes"]["sentry.op"] == "cache.get" assert spans[0]["name"].startswith("views.decorators.cache.cache_header.") @@ -370,7 +370,7 @@ def test_cache_spans_decorator( client.get(reverse("cached_view")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # first_event - cache.get assert spans[0]["attributes"]["sentry.op"] == "cache.get" assert spans[0]["name"].startswith("views.decorators.cache.cache_header.") @@ -470,7 +470,7 @@ def test_cache_spans_templatetag( client.get(reverse("view_with_cached_template_fragment")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 5 # first_event - cache.get assert spans[0]["attributes"]["sentry.op"] == "cache.get" @@ -607,7 +607,7 @@ def test_cache_spans_location_with_port( client.get(reverse("cached_view")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["is_segment"] is True: @@ -660,7 +660,7 @@ def test_cache_spans_location_without_port( client.get(reverse("cached_view")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["is_segment"] is True: @@ -709,7 +709,7 @@ def test_cache_spans_location_with_cluster( client.get(reverse("cached_view")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: # because it is a cluster we do not know what host is actually accessed, so we omit the data @@ -757,7 +757,7 @@ def test_cache_spans_item_size( client.get(reverse("cached_view")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 7 assert spans[0]["attributes"]["sentry.op"] == "cache.get" assert not spans[0]["attributes"]["cache.hit"] @@ -851,7 +851,7 @@ def test_cache_spans_get_custom_default( cache.get(f"S{id + 2}", default="null") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 9 assert spans[0]["attributes"]["sentry.op"] == "cache.put" @@ -956,7 +956,7 @@ def test_cache_spans_get_many( cache.get_many([f"S{id}", f"S{id + 1}"]) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 8 assert spans[2]["attributes"]["sentry.op"] == "cache.get" @@ -1058,7 +1058,7 @@ def test_cache_spans_set_many( cache.get(f"S{id}") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 5 assert spans[2]["attributes"]["sentry.op"] == "cache.put" @@ -1125,7 +1125,7 @@ def test_span_origin_cache( client.get(reverse("cached_view")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[1]["attributes"]["sentry.origin"] == "auto.http.django" diff --git a/tests/integrations/django/test_db_query_data.py b/tests/integrations/django/test_db_query_data.py index 638c24a655..36b7f3058c 100644 --- a/tests/integrations/django/test_db_query_data.py +++ b/tests/integrations/django/test_db_query_data.py @@ -66,7 +66,7 @@ def test_query_source_disabled( assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and "auth_user" in span.get( @@ -143,7 +143,7 @@ def test_query_source_enabled( assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and "auth_user" in span.get( @@ -214,7 +214,7 @@ def test_query_source( assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and "auth_user" in span.get( @@ -322,7 +322,7 @@ def test_query_source_with_module_in_search_path( assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and "auth_user" in span.get( @@ -416,7 +416,7 @@ def test_query_source_with_in_app_exclude( assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and "auth_user" in span.get( @@ -538,7 +538,7 @@ def test_query_source_with_in_app_include( assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and "auth_user" in span.get( @@ -662,7 +662,7 @@ def __exit__(self, type, value, traceback): assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and "auth_user" in span.get( @@ -768,7 +768,7 @@ def __exit__(self, type, value, traceback): assert status == "200 OK" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and "auth_user" in span.get( @@ -870,7 +870,7 @@ def test_db_span_origin_execute( client.get(reverse("postgres_select_orm")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[1]["attributes"]["sentry.origin"] == "auto.http.django" @@ -937,7 +937,7 @@ def test_db_span_origin_executemany( transaction.commit() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[1]["attributes"]["sentry.origin"] == "manual" assert spans[0]["attributes"]["sentry.origin"] == "auto.db.django" diff --git a/tests/integrations/django/test_db_transactions.py b/tests/integrations/django/test_db_transactions.py index db56e467af..b3e484c957 100644 --- a/tests/integrations/django/test_db_transactions.py +++ b/tests/integrations/django/test_db_transactions.py @@ -135,7 +135,7 @@ def test_db_transaction_spans_disabled_no_autocommit( transaction.set_autocommit(True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] postgres_rollback = spans[4] assert postgres_rollback["is_segment"] is True @@ -376,7 +376,7 @@ def test_db_transaction_spans_disabled_atomic( cursor.executemany(query, query_list) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] postgres_rollback = spans[4] assert postgres_rollback["is_segment"] is True @@ -528,7 +528,7 @@ def test_db_no_autocommit_execute( client.get(reverse("postgres_insert_orm_no_autocommit")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is persisted assert User.objects.using("postgres").exists() @@ -671,7 +671,7 @@ def test_db_no_autocommit_executemany( transaction.set_autocommit(True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is persisted assert User.objects.exists() @@ -810,7 +810,7 @@ def test_db_no_autocommit_rollback_execute( client.get(reverse("postgres_insert_orm_no_autocommit_rollback")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is rolled back assert not User.objects.using("postgres").exists() @@ -954,7 +954,7 @@ def test_db_no_autocommit_rollback_executemany( transaction.set_autocommit(True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is rolled back assert not User.objects.exists() @@ -1092,7 +1092,7 @@ def test_db_atomic_execute( client.get(reverse("postgres_insert_orm_atomic")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is persisted assert User.objects.using("postgres").exists() @@ -1233,7 +1233,7 @@ def test_db_atomic_executemany( cursor.executemany(query, query_list) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is persisted assert User.objects.exists() @@ -1366,7 +1366,7 @@ def test_db_atomic_rollback_execute( client.get(reverse("postgres_insert_orm_atomic_rollback")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is rolled back assert not User.objects.using("postgres").exists() @@ -1510,7 +1510,7 @@ def test_db_atomic_rollback_executemany( transaction.set_rollback(True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is rolled back assert not User.objects.exists() @@ -1647,7 +1647,7 @@ def test_db_atomic_execute_exception( client.get(reverse("postgres_insert_orm_atomic_exception")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is rolled back assert not User.objects.using("postgres").exists() @@ -1793,7 +1793,7 @@ def test_db_atomic_executemany_exception( pass sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Ensure operation is rolled back assert not User.objects.exists() diff --git a/tests/integrations/django/test_tasks.py b/tests/integrations/django/test_tasks.py index d566421482..0d2b660a54 100644 --- a/tests/integrations/django/test_tasks.py +++ b/tests/integrations/django/test_tasks.py @@ -72,7 +72,7 @@ def test_task_span_is_created( simple_task.enqueue() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] queue_submit_spans = [ span @@ -151,7 +151,7 @@ def test_task_enqueue_with_kwargs( assert result.return_value == "Hi, World!" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] queue_submit_spans = [ span @@ -210,7 +210,7 @@ def test_task_error_reporting( _ = result.return_value sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] queue_submit_spans = [ span @@ -276,7 +276,7 @@ def test_multiple_task_enqueues_create_multiple_spans( task_one.enqueue() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] queue_submit_spans = [ span diff --git a/tests/integrations/google_genai/test_google_genai.py b/tests/integrations/google_genai/test_google_genai.py index 16c556031b..fffbdcee5b 100644 --- a/tests/integrations/google_genai/test_google_genai.py +++ b/tests/integrations/google_genai/test_google_genai.py @@ -543,7 +543,7 @@ def get_weather(location: str) -> str: assert result == "The weather in San Francisco is sunny" sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 1 sentry_sdk.flush() tool_span = next(item.payload for item in items if item.type == "span") @@ -743,7 +743,7 @@ def test_streaming_generate_content( ) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 1 sentry_sdk.flush() chat_span = next(item.payload for item in items if item.type == "span") @@ -1207,7 +1207,7 @@ def test_empty_response( # Should still create spans even with empty candidates sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 1 else: events = capture_events() @@ -1746,7 +1746,7 @@ def test_embed_content_string_input( ) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (embed_span,) = spans # Check that single string is handled correctly @@ -1886,7 +1886,7 @@ def test_embed_content_without_statistics( ) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (embed_span,) = spans # No usage tokens since there are no statistics in older versions @@ -2153,7 +2153,7 @@ async def test_async_embed_content_string_input( ) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (embed_span,) = spans # Check that single string is handled correctly @@ -2299,7 +2299,7 @@ async def test_async_embed_content_without_statistics( ) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (embed_span,) = spans # No usage tokens since there are no statistics in older versions diff --git a/tests/integrations/grpc/test_grpc_aio.py b/tests/integrations/grpc/test_grpc_aio.py index 5248b4369c..5d0b2c1fdb 100644 --- a/tests/integrations/grpc/test_grpc_aio.py +++ b/tests/integrations/grpc/test_grpc_aio.py @@ -99,7 +99,7 @@ async def test_noop_for_unimplemented_method( await server.stop(None) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 1 # Only client span present. else: events = capture_events() @@ -137,7 +137,7 @@ async def test_grpc_server_starts_transaction( await stub.TestServe(gRPCTestMessage(text="test")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] span = spans[0] assert spans[1]["attributes"]["sentry.span.source"] == "custom" @@ -197,7 +197,7 @@ async def test_grpc_server_continues_transaction( await stub.TestServe(gRPCTestMessage(text="test"), metadata=metadata) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] span = spans[0] assert spans[1]["attributes"]["sentry.span.source"] == "custom" diff --git a/tests/integrations/langchain/test_langchain.py b/tests/integrations/langchain/test_langchain.py index 14f57f0c0a..22f5074ed8 100644 --- a/tests/integrations/langchain/test_langchain.py +++ b/tests/integrations/langchain/test_langchain.py @@ -421,7 +421,7 @@ def test_langchain_chat_with_run_name( ) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans if x["attributes"]["sentry.op"] == "gen_ai.chat" ) @@ -482,7 +482,7 @@ def test_langchain_tool_call_with_run_name( ) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] tool_spans = list( x for x in spans if x["attributes"]["sentry.op"] == "gen_ai.execute_tool" ) @@ -2863,7 +2863,7 @@ def _llm_type(self) -> str: list(agent_executor.stream({"input": test_input})) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find spans with gen_ai operation that should have message data gen_ai_spans = [ span @@ -3145,7 +3145,7 @@ def test_langchain_embeddings_sync( mock_embed_documents.assert_called_once() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find embeddings span embeddings_spans = [ span @@ -3294,7 +3294,7 @@ def test_langchain_embeddings_embed_query( mock_embed_query.assert_called_once() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find embeddings span embeddings_spans = [ span @@ -3441,7 +3441,7 @@ async def mock_aembed_documents(self, texts): mock_aembed.assert_called_once() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find embeddings span embeddings_spans = [ span @@ -3592,7 +3592,7 @@ async def mock_aembed_query(self, text): mock_aembed.assert_called_once() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find embeddings span embeddings_spans = [ span @@ -3706,7 +3706,7 @@ def test_langchain_embeddings_no_model_name( embeddings.embed_documents(["Test"]) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find embeddings span embeddings_spans = [ span @@ -3806,7 +3806,7 @@ def test_langchain_embeddings_integration_disabled( # Check that no embeddings spans were created sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] embeddings_spans = [ span for span in spans @@ -3893,7 +3893,7 @@ def test_langchain_embeddings_multiple_providers( azure_embeddings.embed_documents(["Azure test"]) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find embeddings spans embeddings_spans = [ span @@ -4049,7 +4049,7 @@ def test_langchain_embeddings_multiple_calls( embeddings.embed_documents(["Third batch"]) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find embeddings spans - should have 3 (2 embed_documents + 1 embed_query) embeddings_spans = [ span @@ -4335,7 +4335,7 @@ def test_langchain_embeddings_with_list_and_string_inputs( embeddings.embed_query("Single string query") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find embeddings spans embeddings_spans = [ span @@ -4460,7 +4460,7 @@ def test_langchain_response_model_extraction( callback.on_llm_end(response=response, run_id=run_id) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] llm_spans = [ span for span in spans @@ -4814,7 +4814,7 @@ def test_langchain_ai_system_detection( callback.on_llm_end(response=response, run_id=run_id) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] llm_spans = [ span for span in spans diff --git a/tests/integrations/langgraph/test_langgraph.py b/tests/integrations/langgraph/test_langgraph.py index b70afe598f..0b85cca3cc 100644 --- a/tests/integrations/langgraph/test_langgraph.py +++ b/tests/integrations/langgraph/test_langgraph.py @@ -181,7 +181,7 @@ def original_compile(self, *args, **kwargs): assert compiled_graph is not None assert compiled_graph.name == "test_graph" - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] agent_spans = [ span for span in spans @@ -308,7 +308,7 @@ def original_invoke(self, *args, **kwargs): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -491,7 +491,7 @@ async def run_test(): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -619,7 +619,7 @@ def original_invoke(self, *args, **kwargs): wrapped_invoke(pregel, test_state) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -686,7 +686,7 @@ async def run_error_test(): asyncio.run(run_error_test()) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -799,7 +799,7 @@ def original_invoke(self, *args, **kwargs): wrapped_invoke(pregel, {"messages": []}) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -913,7 +913,7 @@ def original_invoke(self, *args, **kwargs): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -1034,7 +1034,7 @@ async def run_test(): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -1160,7 +1160,7 @@ def original_invoke(self, *args, **kwargs): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -1280,7 +1280,7 @@ async def run_test(): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -1383,7 +1383,7 @@ def original_invoke(self, *args, **kwargs): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -1497,7 +1497,7 @@ async def run_test(): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -1618,7 +1618,7 @@ def original_invoke(self, *args, **kwargs): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -1743,7 +1743,7 @@ async def run_test(): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans @@ -1890,7 +1890,7 @@ def original_invoke(self, *args, **kwargs): assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] invoke_spans = [ span for span in spans diff --git a/tests/integrations/litellm/test_litellm.py b/tests/integrations/litellm/test_litellm.py index b859dd1222..6b3d0ed58c 100644 --- a/tests/integrations/litellm/test_litellm.py +++ b/tests/integrations/litellm/test_litellm.py @@ -519,7 +519,7 @@ def test_streaming_chat_completion( streaming_handler.executor.shutdown(wait=True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -638,7 +638,7 @@ async def test_async_streaming_chat_completion( await asyncio.sleep(0.5) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -741,7 +741,7 @@ def test_embeddings_create( # Response is processed by litellm, so just check it exists assert response is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] spans = list( x for x in spans @@ -863,7 +863,7 @@ async def test_async_embeddings_create( # Response is processed by litellm, so just check it exists assert response is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] spans = list( x for x in spans @@ -980,7 +980,7 @@ def test_embeddings_create_with_list_input( assert response is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] spans = list( x for x in spans @@ -1094,7 +1094,7 @@ async def test_async_embeddings_create_with_list_input( # Response is processed by litellm, so just check it exists assert response is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] spans = list( x for x in spans @@ -1207,7 +1207,7 @@ def test_embeddings_no_pii( # Response is processed by litellm, so just check it exists assert response is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] spans = list( x for x in spans @@ -1308,7 +1308,7 @@ async def test_async_embeddings_no_pii( # Response is processed by litellm, so just check it exists assert response is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] spans = list( x for x in spans @@ -1400,11 +1400,7 @@ def test_exception_handling( ) # Find the error event - error_events = [ - item.payload - for item in items - if item.type == "event" and item.payload.get("level") == "error" - ] + error_events = [item.payload for item in items] else: events = capture_events() @@ -1470,11 +1466,7 @@ async def test_async_exception_handling( ) # Find the error event - error_events = [ - item.payload - for item in items - if item.type == "event" and item.payload.get("level") == "error" - ] + error_events = [item.payload for item in items] else: events = capture_events() @@ -2098,7 +2090,7 @@ def test_additional_parameters( litellm_utils.executor.shutdown(wait=True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -2213,7 +2205,7 @@ async def test_async_additional_parameters( await asyncio.sleep(0.5) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -2322,7 +2314,7 @@ def test_no_integration( litellm_utils.executor.shutdown(wait=True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -2413,7 +2405,7 @@ async def test_async_no_integration( await asyncio.sleep(0.5) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -2672,7 +2664,7 @@ def test_binary_content_encoding_image_url( litellm_utils.executor.shutdown(wait=True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -2798,7 +2790,7 @@ async def test_async_binary_content_encoding_image_url( await asyncio.sleep(0.5) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -2925,7 +2917,7 @@ def test_binary_content_encoding_mixed_content( litellm_utils.executor.shutdown(wait=True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -3040,7 +3032,7 @@ async def test_async_binary_content_encoding_mixed_content( await asyncio.sleep(0.5) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -3152,7 +3144,7 @@ def test_binary_content_encoding_uri_type( litellm_utils.executor.shutdown(wait=True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans @@ -3272,7 +3264,7 @@ async def test_async_binary_content_encoding_uri_type( await asyncio.sleep(0.5) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = list( x for x in spans diff --git a/tests/integrations/openai/test_openai.py b/tests/integrations/openai/test_openai.py index e37920628f..5ca4cb7d5a 100644 --- a/tests/integrations/openai/test_openai.py +++ b/tests/integrations/openai/test_openai.py @@ -3861,7 +3861,7 @@ def test_ai_client_span_responses_api_no_pii( top_p=0.9, ) - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 1 assert spans[0]["attributes"] == { @@ -4171,7 +4171,7 @@ def test_ai_client_span_responses_api( top_p=0.9, ) - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 1 @@ -4658,7 +4658,7 @@ async def test_ai_client_span_responses_async_api( top_p=0.9, ) - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 1 @@ -4946,7 +4946,7 @@ async def test_ai_client_span_streaming_responses_async_api( pass sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] spans = [ span for span in spans diff --git a/tests/integrations/pydantic_ai/test_pydantic_ai.py b/tests/integrations/pydantic_ai/test_pydantic_ai.py index 5a834f633a..fbf210d76a 100644 --- a/tests/integrations/pydantic_ai/test_pydantic_ai.py +++ b/tests/integrations/pydantic_ai/test_pydantic_ai.py @@ -754,7 +754,7 @@ def add_numbers(a: int, b: int) -> int: assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find child span types (invoke_agent is the transaction, not a child span) chat_spans = [ @@ -1131,7 +1131,7 @@ def multiply(a: int, b: int) -> int: pass sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find span types chat_spans = [ @@ -1212,7 +1212,7 @@ async def test_model_settings( await test_agent_with_settings.run("Test input") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find chat span chat_spans = [ @@ -1288,7 +1288,7 @@ async def test_system_prompt_attribute( await agent.run("Hello") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # The transaction IS the invoke_agent span, check for messages in chat spans instead chat_spans = [ @@ -1432,7 +1432,7 @@ async def test_without_pii( await test_agent.run("Sensitive input") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find child spans (invoke_agent is the transaction, not a child span) chat_spans = [ @@ -1496,7 +1496,7 @@ def sensitive_tool(data: str) -> str: await test_agent.run("Use sensitive tool with private data") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find tool spans tool_spans = [ @@ -1575,7 +1575,7 @@ async def run_agent(input_text): assert len(results) == 3 # Verify each transaction is separate - events = [item.payload for item in items if item.type == "transaction"] + events = [item.payload for item in items] assert len(events) == 3 for i, transaction in enumerate(events): assert transaction["transaction"] == "invoke_agent test_agent" @@ -1644,7 +1644,7 @@ async def test_message_history( await agent.run("What is my name?", message_history=history) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = [ s for s in spans if s["attributes"].get("sentry.op", "") == "gen_ai.chat" ] @@ -1708,7 +1708,7 @@ async def test_gen_ai_system( await test_agent.run("Test input") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find chat span chat_spans = [ @@ -1768,7 +1768,7 @@ async def test_include_prompts_false( await test_agent.run("Sensitive prompt") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find child spans (invoke_agent is the transaction, not a child span) chat_spans = [ @@ -1826,7 +1826,7 @@ async def test_include_prompts_true( await test_agent.run("Test prompt") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find child spans (invoke_agent is the transaction, not a child span) chat_spans = [ @@ -1889,7 +1889,7 @@ def test_tool(value: int) -> int: await test_agent.run("Use the test tool with value 5") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find tool spans tool_spans = [ @@ -1949,7 +1949,7 @@ async def test_include_prompts_requires_pii( await test_agent.run("Test prompt") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # Find child spans (invoke_agent is the transaction, not a child span) chat_spans = [ @@ -2180,7 +2180,7 @@ async def test_invoke_agent_with_list_user_prompt( # Use a list as user prompt await agent.run(["First part", "Second part"]) - (transaction,) = [item.payload for item in items if item.type == "transaction"] + (transaction,) = [item.payload for item in items] # Check that the invoke_agent transaction has messages data # The invoke_agent is the transaction itself @@ -2258,7 +2258,7 @@ async def test_invoke_agent_with_instructions( await agent.run("Test input") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] # The transaction IS the invoke_agent span, check for messages in chat spans instead chat_spans = [ @@ -2424,7 +2424,7 @@ async def test_usage_data_partial( await agent.run("Test input") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = [ s for s in spans if s["attributes"].get("sentry.op", "") == "gen_ai.chat" @@ -2541,7 +2541,7 @@ def tool_without_desc(x: int) -> int: await test_agent.run("Use the tool with 5") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = [ s for s in spans if s["attributes"].get("sentry.op", "") == "gen_ai.chat" @@ -2602,7 +2602,7 @@ def calc_tool(value: int) -> int: await test_agent.run("Use calc_tool with 5") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = [ s for s in spans if s["attributes"].get("sentry.op", "") == "gen_ai.chat" @@ -2681,7 +2681,7 @@ async def test_message_formatting_with_different_parts( await agent.run("What did I say?", message_history=history) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = [ s for s in spans if s["attributes"].get("sentry.op", "") == "gen_ai.chat" @@ -3017,7 +3017,7 @@ def test_tool(x: int) -> int: await agent.run("Use test_tool with 5") sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = [ s for s in spans if s["attributes"].get("sentry.op", "") == "gen_ai.chat" @@ -4176,7 +4176,7 @@ async def test_binary_content_in_agent_run( await agent.run(["Analyze this image:", binary_content]) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = [ s for s in spans if s["attributes"].get("sentry.op", "") == "gen_ai.chat" ] @@ -4365,7 +4365,7 @@ def test_image_url_base64_content_in_span( span.finish() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = [ s for s in spans if s["attributes"].get("sentry.op", "") == "gen_ai.chat" ] @@ -4470,7 +4470,7 @@ async def test_invoke_agent_image_url( found_image = False sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] chat_spans = [ s for s in spans if s["attributes"].get("sentry.op", "") == "gen_ai.chat" ] @@ -4545,7 +4545,7 @@ def multiply_numbers(a: int, b: int) -> int: assert result is not None sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] tool_spans = [ s diff --git a/tests/integrations/rq/test_rq.py b/tests/integrations/rq/test_rq.py index b32a60fd63..8aa36feb6a 100644 --- a/tests/integrations/rq/test_rq.py +++ b/tests/integrations/rq/test_rq.py @@ -307,7 +307,7 @@ def test_tracing_enabled( assert error_event["contexts"]["trace"]["trace_id"] == span.trace_id sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (span,) = ( span for span in spans @@ -535,7 +535,7 @@ def test_span_origin( worker.work(burst=True) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (span,) = ( span for span in spans diff --git a/tests/integrations/rust_tracing/test_rust_tracing.py b/tests/integrations/rust_tracing/test_rust_tracing.py index dcd79dcc1a..31d5686c5a 100644 --- a/tests/integrations/rust_tracing/test_rust_tracing.py +++ b/tests/integrations/rust_tracing/test_rust_tracing.py @@ -96,7 +96,7 @@ def test_on_new_span_on_close( assert sentry_sdk.traces.get_current_span() != sentry_first_rust_span sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 2 # Ensure the span metadata is wired up @@ -197,7 +197,7 @@ def test_nested_on_new_span_on_close( assert sentry_sdk.traces.get_current_span() == original_sentry_span sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 3 # Ensure the span metadata is wired up for all spans @@ -530,7 +530,7 @@ def test_on_event_ignored( rust_tracing.close_span(3) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[1]["is_segment"] is True else: events = capture_events() @@ -598,7 +598,7 @@ def span_filter(metadata: Dict[str, object]) -> bool: assert sentry_sdk.traces.get_current_span() == original_sentry_span sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 2 # The ignored span has index == 9 assert spans[0]["attributes"]["index"] == 10 diff --git a/tests/integrations/sqlalchemy/test_sqlalchemy.py b/tests/integrations/sqlalchemy/test_sqlalchemy.py index 4dba6ae8b2..98cca3d047 100644 --- a/tests/integrations/sqlalchemy/test_sqlalchemy.py +++ b/tests/integrations/sqlalchemy/test_sqlalchemy.py @@ -148,7 +148,7 @@ class Address(Base): session.query(Person).first() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] sqlalchemy_spans = [ span for span in spans @@ -279,7 +279,7 @@ class Address(Base): session.query(Person).first() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] sqlalchemy_spans = [ span for span in spans @@ -339,7 +339,7 @@ def test_long_sql_query_preserved( ) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] name = spans[0]["name"] assert name.startswith("SELECT 0 UNION SELECT 1") assert name.endswith("SELECT 98 UNION SELECT 99") @@ -479,7 +479,7 @@ class Person(Base): assert session.query(Person).first() == bob sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and span["name"].startswith( "SELECT person" @@ -581,7 +581,7 @@ class Person(Base): assert session.query(Person).first() == bob sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and span["name"].startswith( "SELECT person" @@ -675,7 +675,7 @@ class Person(Base): assert session.query(Person).first() == bob sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and span["name"].startswith( "SELECT person" @@ -808,7 +808,7 @@ class Person(Base): assert query_first_model_from_session(Person, session) == bob sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and span["name"].startswith( "SELECT person" @@ -953,7 +953,7 @@ def __exit__(self, type, value, traceback): assert session.query(Person).first() == bob sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and span["name"].startswith( "SELECT person" @@ -1084,7 +1084,7 @@ def __exit__(self, type, value, traceback): assert session.query(Person).first() == bob sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] for span in spans: if span["attributes"].get("sentry.op") == "db" and span["name"].startswith( "SELECT person" @@ -1215,7 +1215,7 @@ def test_span_origin( con.execute(text("SELECT 0")) sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[0]["attributes"]["sentry.origin"] == "auto.db.sqlalchemy" assert spans[1]["attributes"]["sentry.origin"] == "manual" diff --git a/tests/integrations/stdlib/test_httplib.py b/tests/integrations/stdlib/test_httplib.py index fdbbb31990..0ad5fb5f95 100644 --- a/tests/integrations/stdlib/test_httplib.py +++ b/tests/integrations/stdlib/test_httplib.py @@ -1060,7 +1060,7 @@ def test_span_origin( conn.getresponse() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[1]["attributes"]["sentry.origin"] == "manual" assert spans[0]["attributes"]["sentry.op"] == "http.client" @@ -1111,7 +1111,7 @@ def test_http_timeout( conn.getresponse() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert len(spans) == 2 span = spans[0] assert span["attributes"]["sentry.op"] == "http.client" @@ -1158,7 +1158,7 @@ def test_proxy_http_tunnel( conn.getresponse() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] (span,) = ( span for span in spans diff --git a/tests/integrations/stdlib/test_subprocess.py b/tests/integrations/stdlib/test_subprocess.py index b20102be4d..90fb61f811 100644 --- a/tests/integrations/stdlib/test_subprocess.py +++ b/tests/integrations/stdlib/test_subprocess.py @@ -365,7 +365,7 @@ def test_subprocess_span_origin( popen.poll() sentry_sdk.flush() - spans = [item.payload for item in items if item.type == "span"] + spans = [item.payload for item in items] assert spans[3]["attributes"]["sentry.origin"] == "manual" From 0f8aca3830917c89194819d4fcf10305a14b93c5 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Wed, 10 Jun 2026 09:02:09 +0200 Subject: [PATCH 3/5] . --- tests/integrations/rq/test_rq.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integrations/rq/test_rq.py b/tests/integrations/rq/test_rq.py index b32a60fd63..0df5759a1e 100644 --- a/tests/integrations/rq/test_rq.py +++ b/tests/integrations/rq/test_rq.py @@ -291,7 +291,7 @@ def test_tracing_enabled( worker = rq.SimpleWorker([queue], connection=queue.connection) if span_streaming: - items = capture_items("span") + items = capture_items("event", "span") with sentry_sdk.traces.start_span( name="custom parent", @@ -302,7 +302,7 @@ def test_tracing_enabled( queue.enqueue(crashing_job, foo=None) worker.work(burst=True) - (error_event,) = (item.payload for item in items) + (error_event,) = (item.payload for item in items if item.type == "event") assert error_event["contexts"]["trace"]["trace_id"] == span.trace_id From 71cc30a76d2b1f96edfbe0dd1f6c0679d9facec7 Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Wed, 10 Jun 2026 09:04:35 +0200 Subject: [PATCH 4/5] . --- tests/integrations/rq/test_rq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integrations/rq/test_rq.py b/tests/integrations/rq/test_rq.py index 37ccaec34e..48e0854d32 100644 --- a/tests/integrations/rq/test_rq.py +++ b/tests/integrations/rq/test_rq.py @@ -307,7 +307,7 @@ def test_tracing_enabled( assert error_event["contexts"]["trace"]["trace_id"] == span.trace_id sentry_sdk.flush() - spans = [item.payload for item in items] + spans = [item.payload for item in items if item.type == "span"] (span,) = ( span for span in spans From 9bdffec88448250d9622ce294fc2d85ae5ac9b3a Mon Sep 17 00:00:00 2001 From: Alexander Alderman Webb Date: Wed, 10 Jun 2026 09:13:30 +0200 Subject: [PATCH 5/5] . --- tests/integrations/django/test_basic.py | 2 +- .../integrations/langchain/test_langchain.py | 2 +- tests/integrations/litellm/test_litellm.py | 4 ++-- .../pydantic_ai/test_pydantic_ai.py | 24 +++++++++---------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index a05cf0095a..4ffad98ad1 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -1629,7 +1629,7 @@ def test_does_not_capture_403( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("span") + items = capture_items("event", "transaction", "span") _, status, _ = unpack_werkzeug_response(client.get(reverse(endpoint))) assert status.lower() == "403 forbidden" diff --git a/tests/integrations/langchain/test_langchain.py b/tests/integrations/langchain/test_langchain.py index 14f57f0c0a..6617f51103 100644 --- a/tests/integrations/langchain/test_langchain.py +++ b/tests/integrations/langchain/test_langchain.py @@ -4149,7 +4149,7 @@ def test_langchain_embeddings_span_hierarchy( _experiments={"trace_lifecycle": "stream" if span_streaming else "static"}, ) if span_streaming: - items = capture_items("span", "transaction") + items = capture_items("span") # Mock the actual API call with mock.patch.object( diff --git a/tests/integrations/litellm/test_litellm.py b/tests/integrations/litellm/test_litellm.py index b859dd1222..75735db616 100644 --- a/tests/integrations/litellm/test_litellm.py +++ b/tests/integrations/litellm/test_litellm.py @@ -1538,7 +1538,7 @@ def test_span_origin( request_headers={"X-Stainless-Raw-Response": "true"}, ) if span_streaming: - items = capture_items("span", "transaction") + items = capture_items("span") with mock.patch.object( client.completions._client._client, @@ -1645,7 +1645,7 @@ def test_multiple_providers( ) if span_streaming: - items = capture_items("span", "transaction") + items = capture_items("span") with mock.patch.object( openai_client.completions._client._client, diff --git a/tests/integrations/pydantic_ai/test_pydantic_ai.py b/tests/integrations/pydantic_ai/test_pydantic_ai.py index 5a834f633a..6afeb6cc18 100644 --- a/tests/integrations/pydantic_ai/test_pydantic_ai.py +++ b/tests/integrations/pydantic_ai/test_pydantic_ai.py @@ -94,7 +94,7 @@ async def test_agent_run_async( test_agent = get_test_agent() if span_streaming: - items = capture_items("span", "transaction") + items = capture_items("span") result = await test_agent.run( ["Message demonstrating the absence of truncation.", "Test input"] @@ -314,7 +314,7 @@ def test_agent_run_sync( test_agent = get_test_agent() if span_streaming: - items = capture_items("span", "transaction") + items = capture_items("span") result = test_agent.run_sync( ["Message demonstrating the absence of truncation.", "Test input"] @@ -480,7 +480,7 @@ async def test_agent_run_stream( test_agent = get_test_agent() if span_streaming: - items = capture_items("span", "transaction") + items = capture_items("span") async with test_agent.run_stream( ["Message demonstrating the absence of truncation.", "Test input"] @@ -633,7 +633,7 @@ async def test_agent_run_stream_events( test_agent = get_test_agent() if span_streaming: - items = capture_items("span", "transaction") + items = capture_items("span") if PYDANTIC_AI_VERSION > (2,): async with test_agent.run_stream_events( @@ -1364,7 +1364,7 @@ async def test_error_handling( ) if span_streaming: - items = capture_items("transaction") + items = capture_items("span") # Simple run that should succeed await agent.run("Hello") @@ -1553,7 +1553,7 @@ async def run_agent(input_text): return await test_agent.run(input_text) if span_streaming: - items = capture_items("transaction") + items = capture_items("span") # Run 3 agents concurrently results = await asyncio.gather(*[run_agent(f"Input {i}") for i in range(3)]) @@ -2162,7 +2162,7 @@ async def test_invoke_agent_with_list_user_prompt( ) if span_streaming: - items = capture_items("transaction") + items = capture_items("span") # Use a list as user prompt await agent.run(["First part", "Second part"]) @@ -2474,7 +2474,7 @@ async def test_agent_data_from_scope( ) if span_streaming: - items = capture_items("transaction") + items = capture_items("span") # The integration automatically sets agent in scope during execution await agent.run("Test input") @@ -2795,7 +2795,7 @@ async def test_agent_without_name( ) if span_streaming: - items = capture_items("transaction") + items = capture_items("span") await agent.run("Test input") @@ -3958,7 +3958,7 @@ async def test_binary_content_encoding_image( ) if span_streaming: - items = capture_items("transaction") + items = capture_items("span") with sentry_sdk.traces.start_span( name="test", attributes={"sentry.op": "test"} @@ -4045,7 +4045,7 @@ async def test_binary_content_encoding_mixed_content( ) if span_streaming: - items = capture_items("transaction") + items = capture_items("span") with sentry_sdk.traces.start_span( name="test", attributes={"sentry.op": "test"} @@ -4225,7 +4225,7 @@ async def test_set_usage_data_with_cache_tokens( ) if span_streaming: - items = capture_items("transaction") + items = capture_items("span") with sentry_sdk.traces.start_span( name="test", attributes={"sentry.op": "test"}