1
- """This package"""
2
1
from __future__ import absolute_import
3
-
4
2
from threading import Lock
5
3
6
4
from sentry_sdk ._compat import iteritems
5
+ from sentry_sdk ._types import TYPE_CHECKING
7
6
from sentry_sdk .utils import logger
8
7
9
- from sentry_sdk ._types import TYPE_CHECKING
10
8
11
9
if TYPE_CHECKING :
12
10
from typing import Callable
13
11
from typing import Dict
14
12
from typing import Iterator
15
13
from typing import List
16
14
from typing import Set
17
- from typing import Tuple
18
15
from typing import Type
19
16
20
17
21
18
_installer_lock = Lock ()
22
19
_installed_integrations = set () # type: Set[str]
23
20
24
21
25
- def _generate_default_integrations_iterator (integrations , auto_enabling_integrations ):
26
- # type: (Tuple[str, ...], Tuple[str, ...]) -> Callable[[bool], Iterator[Type[Integration]]]
22
+ def _generate_default_integrations_iterator (
23
+ integrations , # type: List[str]
24
+ auto_enabling_integrations , # type: List[str]
25
+ ):
26
+ # type: (...) -> Callable[[bool], Iterator[Type[Integration]]]
27
27
28
28
def iter_default_integrations (with_auto_enabling_integrations ):
29
29
# type: (bool) -> Iterator[Type[Integration]]
@@ -51,38 +51,40 @@ def iter_default_integrations(with_auto_enabling_integrations):
51
51
return iter_default_integrations
52
52
53
53
54
- _AUTO_ENABLING_INTEGRATIONS = (
55
- "sentry_sdk.integrations.django.DjangoIntegration" ,
56
- "sentry_sdk.integrations.flask.FlaskIntegration" ,
57
- "sentry_sdk.integrations.starlette.StarletteIntegration" ,
58
- "sentry_sdk.integrations.fastapi.FastApiIntegration" ,
54
+ _DEFAULT_INTEGRATIONS = [
55
+ # stdlib/base runtime integrations
56
+ "sentry_sdk.integrations.argv.ArgvIntegration" ,
57
+ "sentry_sdk.integrations.atexit.AtexitIntegration" ,
58
+ "sentry_sdk.integrations.dedupe.DedupeIntegration" ,
59
+ "sentry_sdk.integrations.excepthook.ExcepthookIntegration" ,
60
+ "sentry_sdk.integrations.logging.LoggingIntegration" ,
61
+ "sentry_sdk.integrations.modules.ModulesIntegration" ,
62
+ "sentry_sdk.integrations.stdlib.StdlibIntegration" ,
63
+ "sentry_sdk.integrations.threading.ThreadingIntegration" ,
64
+ ]
65
+
66
+ _AUTO_ENABLING_INTEGRATIONS = [
67
+ "sentry_sdk.integrations.aiohttp.AioHttpIntegration" ,
68
+ "sentry_sdk.integrations.boto3.Boto3Integration" ,
59
69
"sentry_sdk.integrations.bottle.BottleIntegration" ,
60
- "sentry_sdk.integrations.falcon.FalconIntegration" ,
61
- "sentry_sdk.integrations.sanic.SanicIntegration" ,
62
70
"sentry_sdk.integrations.celery.CeleryIntegration" ,
71
+ "sentry_sdk.integrations.django.DjangoIntegration" ,
72
+ "sentry_sdk.integrations.falcon.FalconIntegration" ,
73
+ "sentry_sdk.integrations.fastapi.FastApiIntegration" ,
74
+ "sentry_sdk.integrations.flask.FlaskIntegration" ,
75
+ "sentry_sdk.integrations.httpx.HttpxIntegration" ,
76
+ "sentry_sdk.integrations.pyramid.PyramidIntegration" ,
77
+ "sentry_sdk.integrations.redis.RedisIntegration" ,
63
78
"sentry_sdk.integrations.rq.RqIntegration" ,
64
- "sentry_sdk.integrations.aiohttp.AioHttpIntegration" ,
65
- "sentry_sdk.integrations.tornado.TornadoIntegration" ,
79
+ "sentry_sdk.integrations.sanic.SanicIntegration" ,
66
80
"sentry_sdk.integrations.sqlalchemy.SqlalchemyIntegration" ,
67
- "sentry_sdk.integrations.redis.RedisIntegration" ,
68
- "sentry_sdk.integrations.pyramid.PyramidIntegration" ,
69
- "sentry_sdk.integrations.boto3.Boto3Integration" ,
70
- "sentry_sdk.integrations.httpx.HttpxIntegration" ,
71
- )
81
+ "sentry_sdk.integrations.starlette.StarletteIntegration" ,
82
+ "sentry_sdk.integrations.tornado.TornadoIntegration" ,
83
+ ]
72
84
73
85
74
86
iter_default_integrations = _generate_default_integrations_iterator (
75
- integrations = (
76
- # stdlib/base runtime integrations
77
- "sentry_sdk.integrations.logging.LoggingIntegration" ,
78
- "sentry_sdk.integrations.stdlib.StdlibIntegration" ,
79
- "sentry_sdk.integrations.excepthook.ExcepthookIntegration" ,
80
- "sentry_sdk.integrations.dedupe.DedupeIntegration" ,
81
- "sentry_sdk.integrations.atexit.AtexitIntegration" ,
82
- "sentry_sdk.integrations.modules.ModulesIntegration" ,
83
- "sentry_sdk.integrations.argv.ArgvIntegration" ,
84
- "sentry_sdk.integrations.threading.ThreadingIntegration" ,
85
- ),
87
+ integrations = _DEFAULT_INTEGRATIONS ,
86
88
auto_enabling_integrations = _AUTO_ENABLING_INTEGRATIONS ,
87
89
)
88
90
@@ -93,8 +95,10 @@ def setup_integrations(
93
95
integrations , with_defaults = True , with_auto_enabling_integrations = False
94
96
):
95
97
# type: (List[Integration], bool, bool) -> Dict[str, Integration]
96
- """Given a list of integration instances this installs them all. When
97
- `with_defaults` is set to `True` then all default integrations are added
98
+ """
99
+ Given a list of integration instances, this installs them all.
100
+
101
+ When `with_defaults` is set to `True` all default integrations are added
98
102
unless they were already provided before.
99
103
"""
100
104
integrations = dict (
0 commit comments