-
Notifications
You must be signed in to change notification settings - Fork 569
fix(integrations): add values for pydantic-ai and openai-agents to _INTEGRATION_DEACTIVATES to prohibit double span creation
#5196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
da4b65f
f6af4b8
3ba7270
8378c34
13d5fa6
5178a11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,8 +26,29 @@ | |
| has_anthropic = False | ||
|
|
||
|
|
||
| try: | ||
| from sentry_sdk.integrations.openai_agents import OpenAIAgentsIntegration | ||
|
|
||
| has_openai_agents = True | ||
| except Exception: | ||
| has_openai_agents = False | ||
|
|
||
| try: | ||
| from sentry_sdk.integrations.pydantic_ai import PydanticAIIntegration | ||
|
|
||
| has_pydantic_ai = True | ||
| except Exception: | ||
| has_pydantic_ai = False | ||
|
|
||
|
|
||
| pytestmark = pytest.mark.skipif( | ||
| not (has_langchain and has_openai and has_anthropic), | ||
| not ( | ||
| has_langchain | ||
| and has_openai | ||
| and has_anthropic | ||
| and has_openai_agents | ||
| and has_pydantic_ai | ||
| ), | ||
| reason="Requires langchain, openai, and anthropic packages to be installed", | ||
| ) | ||
|
|
||
|
|
@@ -36,6 +57,11 @@ def test_integration_deactivates_map_exists(): | |
| assert "langchain" in _INTEGRATION_DEACTIVATES | ||
| assert "openai" in _INTEGRATION_DEACTIVATES["langchain"] | ||
| assert "anthropic" in _INTEGRATION_DEACTIVATES["langchain"] | ||
| assert "openai_agents" in _INTEGRATION_DEACTIVATES | ||
| assert "openai" in _INTEGRATION_DEACTIVATES["openai_agents"] | ||
| assert "pydantic_ai" in _INTEGRATION_DEACTIVATES | ||
| assert "openai" in _INTEGRATION_DEACTIVATES["pydantic_ai"] | ||
| assert "anthropic" in _INTEGRATION_DEACTIVATES["pydantic_ai"] | ||
|
|
||
|
|
||
| def test_langchain_auto_deactivates_openai_and_anthropic( | ||
|
|
@@ -104,13 +130,17 @@ def test_user_can_override_with_both_explicit_integrations( | |
| assert AnthropicIntegration in integration_types | ||
|
|
||
|
|
||
| def test_disabling_langchain_allows_openai_and_anthropic( | ||
| def test_disabling_integrations_allows_openai_and_anthropic( | ||
| sentry_init, reset_integrations | ||
| ): | ||
| sentry_init( | ||
| default_integrations=False, | ||
| auto_enabling_integrations=True, | ||
| disabled_integrations=[LangchainIntegration], | ||
| disabled_integrations=[ | ||
| LangchainIntegration, | ||
| OpenAIAgentsIntegration, | ||
| PydanticAIIntegration, | ||
| ], | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Test doesn't verify OpenAI/Anthropic integrations are enabledThe test |
||
| ) | ||
|
|
||
| client = get_client() | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.