Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions tests/integrations/anthropic/test_anthropic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests/integrations/google_genai/test_google_genai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
32 changes: 16 additions & 16 deletions tests/integrations/langgraph/test_langgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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())

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Loading
Loading