|
12 | 12 | _installed_integrations = set()
|
13 | 13 |
|
14 | 14 |
|
15 |
| -def iter_default_integrations(): |
16 |
| - """Returns an iterator of default integration classes. |
17 |
| -
|
18 |
| - This returns the following default integration: |
19 |
| -
|
20 |
| - - `LoggingIntegration` |
21 |
| - - `StdlibIntegration` |
22 |
| - - `ExcepthookIntegration` |
23 |
| - - `DedupeIntegration` |
24 |
| - - `AtexitIntegration` |
25 |
| - - `ModulesIntegration` |
26 |
| - - `ArgvIntegration` |
27 |
| - """ |
28 |
| - from sentry_sdk.integrations.logging import LoggingIntegration |
29 |
| - from sentry_sdk.integrations.stdlib import StdlibIntegration |
30 |
| - from sentry_sdk.integrations.excepthook import ExcepthookIntegration |
31 |
| - from sentry_sdk.integrations.dedupe import DedupeIntegration |
32 |
| - from sentry_sdk.integrations.atexit import AtexitIntegration |
33 |
| - from sentry_sdk.integrations.modules import ModulesIntegration |
34 |
| - from sentry_sdk.integrations.argv import ArgvIntegration |
35 |
| - from sentry_sdk.integrations.threading import ThreadingIntegration |
36 |
| - |
37 |
| - yield LoggingIntegration |
38 |
| - yield StdlibIntegration |
39 |
| - yield ExcepthookIntegration |
40 |
| - yield DedupeIntegration |
41 |
| - yield AtexitIntegration |
42 |
| - yield ModulesIntegration |
43 |
| - yield ArgvIntegration |
44 |
| - yield ThreadingIntegration |
| 15 | +def _generate_default_integrations_iterator(*import_strings): |
| 16 | + def iter_default_integrations(): |
| 17 | + # type: () -> Iterator[Type[Integration]] |
| 18 | + """Returns an iterator of the default integration classes: |
| 19 | + """ |
| 20 | + for import_string in import_strings: |
| 21 | + module, cls = import_strings.rsplit(".", 1) |
| 22 | + yield getattr(__import__(module), cls) |
| 23 | + |
| 24 | + for import_string in import_strings: |
| 25 | + iter_default_integrations.__doc__ += "\n- `{}`".format(import_string) |
| 26 | + |
| 27 | + return iter_default_integrations |
| 28 | + |
| 29 | + |
| 30 | +iter_default_integrations = _generate_default_integrations_iterator( |
| 31 | + "sentry_sdk.integrations.logging.LoggingIntegration", |
| 32 | + "sentry_sdk.integrations.stdlib.StdlibIntegration", |
| 33 | + "sentry_sdk.integrations.excepthook.ExcepthookIntegration", |
| 34 | + "sentry_sdk.integrations.dedupe.DedupeIntegration", |
| 35 | + "sentry_sdk.integrations.atexit.AtexitIntegration", |
| 36 | + "sentry_sdk.integrations.modules.ModulesIntegration", |
| 37 | + "sentry_sdk.integrations.argv.ArgvIntegration", |
| 38 | + "sentry_sdk.integrations.threading.ThreadingIntegration", |
| 39 | +) |
| 40 | + |
| 41 | +del _generate_default_integrations_iterator |
45 | 42 |
|
46 | 43 |
|
47 | 44 | def setup_integrations(integrations, with_defaults=True):
|
|
0 commit comments