-
Notifications
You must be signed in to change notification settings - Fork 572
feat(api): Support delayed integration enabling #5285
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
0ea4a5f
8135702
5a18190
29a3b6b
15c5016
49bda60
3ae2c6a
0110fc6
cdfcd78
2afd472
cd091d5
be60345
44dd1e5
1ba998a
b2358eb
8fc34fb
51045da
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 |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| from threading import Lock | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| import sentry_sdk | ||
| from sentry_sdk.utils import logger | ||
|
|
||
| if TYPE_CHECKING: | ||
|
|
@@ -279,6 +280,31 @@ def setup_integrations( | |
| return integrations | ||
|
|
||
|
|
||
| def _enable_integration(integration: "Integration") -> "Optional[Integration]": | ||
| with _installer_lock: | ||
| client = sentry_sdk.get_client() | ||
|
|
||
|
Comment on lines
+283
to
+286
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: If an integration fails to initialize, 🔍 Detailed AnalysisIf an integration fails to initialize during 💡 Suggested FixIn 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
| if ( | ||
| integration.identifier in _installed_integrations | ||
| and integration.identifier in client.integrations | ||
| ): | ||
| return client.integrations[integration.identifier] | ||
|
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.
|
||
|
|
||
| logger.debug( | ||
| "Setting up previously not enabled integration %s", integration.identifier | ||
| ) | ||
| _processed_integrations.add(integration.identifier) | ||
|
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. Failed
|
||
| try: | ||
| type(integration).setup_once() | ||
| integration.setup_once_with_options(client.options) | ||
| except DidNotEnable as e: | ||
| logger.debug("Did not enable integration %s: %s", integration.identifier, e) | ||
| return None | ||
| else: | ||
| _installed_integrations.add(integration.identifier) | ||
| return integration | ||
|
|
||
|
|
||
| def _check_minimum_version( | ||
| integration: "type[Integration]", | ||
| version: "Optional[tuple[int, ...]]", | ||
|
|
||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see how. The actual logic is wrapped in a lock.