sentry-sdk 2.26.1__py2.py3-none-any.whl → 3.0.0a1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sentry-sdk might be problematic. Click here for more details.
- sentry_sdk/__init__.py +4 -8
- sentry_sdk/_compat.py +0 -1
- sentry_sdk/_init_implementation.py +6 -44
- sentry_sdk/_log_batcher.py +47 -28
- sentry_sdk/_types.py +8 -64
- sentry_sdk/ai/monitoring.py +14 -10
- sentry_sdk/ai/utils.py +1 -1
- sentry_sdk/api.py +69 -163
- sentry_sdk/client.py +25 -72
- sentry_sdk/consts.py +42 -23
- sentry_sdk/debug.py +0 -10
- sentry_sdk/envelope.py +2 -10
- sentry_sdk/feature_flags.py +5 -1
- sentry_sdk/integrations/__init__.py +5 -2
- sentry_sdk/integrations/_asgi_common.py +3 -3
- sentry_sdk/integrations/_wsgi_common.py +11 -40
- sentry_sdk/integrations/aiohttp.py +104 -57
- sentry_sdk/integrations/anthropic.py +10 -7
- sentry_sdk/integrations/arq.py +24 -13
- sentry_sdk/integrations/asgi.py +103 -83
- sentry_sdk/integrations/asyncio.py +1 -0
- sentry_sdk/integrations/asyncpg.py +45 -30
- sentry_sdk/integrations/aws_lambda.py +109 -92
- sentry_sdk/integrations/boto3.py +38 -9
- sentry_sdk/integrations/bottle.py +1 -1
- sentry_sdk/integrations/celery/__init__.py +48 -38
- sentry_sdk/integrations/clickhouse_driver.py +59 -28
- sentry_sdk/integrations/cohere.py +2 -0
- sentry_sdk/integrations/django/__init__.py +25 -46
- sentry_sdk/integrations/django/asgi.py +6 -2
- sentry_sdk/integrations/django/caching.py +13 -22
- sentry_sdk/integrations/django/middleware.py +1 -0
- sentry_sdk/integrations/django/signals_handlers.py +3 -1
- sentry_sdk/integrations/django/templates.py +8 -12
- sentry_sdk/integrations/django/transactions.py +1 -6
- sentry_sdk/integrations/django/views.py +5 -2
- sentry_sdk/integrations/falcon.py +7 -25
- sentry_sdk/integrations/fastapi.py +3 -3
- sentry_sdk/integrations/flask.py +1 -1
- sentry_sdk/integrations/gcp.py +63 -38
- sentry_sdk/integrations/graphene.py +6 -13
- sentry_sdk/integrations/grpc/aio/client.py +14 -8
- sentry_sdk/integrations/grpc/aio/server.py +19 -21
- sentry_sdk/integrations/grpc/client.py +8 -6
- sentry_sdk/integrations/grpc/server.py +12 -14
- sentry_sdk/integrations/httpx.py +47 -12
- sentry_sdk/integrations/huey.py +26 -22
- sentry_sdk/integrations/huggingface_hub.py +1 -0
- sentry_sdk/integrations/langchain.py +22 -15
- sentry_sdk/integrations/launchdarkly.py +3 -3
- sentry_sdk/integrations/litestar.py +4 -2
- sentry_sdk/integrations/logging.py +12 -3
- sentry_sdk/integrations/openai.py +2 -0
- sentry_sdk/integrations/openfeature.py +3 -5
- sentry_sdk/integrations/pymongo.py +18 -25
- sentry_sdk/integrations/pyramid.py +1 -1
- sentry_sdk/integrations/quart.py +3 -3
- sentry_sdk/integrations/ray.py +23 -17
- sentry_sdk/integrations/redis/_async_common.py +30 -18
- sentry_sdk/integrations/redis/_sync_common.py +28 -18
- sentry_sdk/integrations/redis/modules/caches.py +13 -10
- sentry_sdk/integrations/redis/modules/queries.py +14 -11
- sentry_sdk/integrations/redis/rb.py +4 -4
- sentry_sdk/integrations/redis/redis.py +6 -6
- sentry_sdk/integrations/redis/redis_cluster.py +18 -16
- sentry_sdk/integrations/redis/redis_py_cluster_legacy.py +4 -4
- sentry_sdk/integrations/redis/utils.py +63 -19
- sentry_sdk/integrations/rq.py +68 -23
- sentry_sdk/integrations/rust_tracing.py +28 -43
- sentry_sdk/integrations/sanic.py +23 -13
- sentry_sdk/integrations/socket.py +9 -5
- sentry_sdk/integrations/sqlalchemy.py +8 -8
- sentry_sdk/integrations/starlette.py +11 -31
- sentry_sdk/integrations/starlite.py +4 -2
- sentry_sdk/integrations/stdlib.py +56 -9
- sentry_sdk/integrations/strawberry.py +40 -59
- sentry_sdk/integrations/threading.py +10 -26
- sentry_sdk/integrations/tornado.py +57 -18
- sentry_sdk/integrations/trytond.py +4 -1
- sentry_sdk/integrations/unleash.py +2 -3
- sentry_sdk/integrations/wsgi.py +84 -38
- sentry_sdk/opentelemetry/__init__.py +9 -0
- sentry_sdk/opentelemetry/consts.py +33 -0
- sentry_sdk/opentelemetry/contextvars_context.py +73 -0
- sentry_sdk/{integrations/opentelemetry → opentelemetry}/propagator.py +19 -28
- sentry_sdk/opentelemetry/sampler.py +326 -0
- sentry_sdk/opentelemetry/scope.py +218 -0
- sentry_sdk/opentelemetry/span_processor.py +329 -0
- sentry_sdk/opentelemetry/tracing.py +35 -0
- sentry_sdk/opentelemetry/utils.py +476 -0
- sentry_sdk/profiler/__init__.py +0 -40
- sentry_sdk/profiler/continuous_profiler.py +1 -30
- sentry_sdk/profiler/transaction_profiler.py +5 -56
- sentry_sdk/scope.py +107 -351
- sentry_sdk/sessions.py +0 -87
- sentry_sdk/tracing.py +418 -1134
- sentry_sdk/tracing_utils.py +134 -169
- sentry_sdk/transport.py +4 -104
- sentry_sdk/types.py +26 -2
- sentry_sdk/utils.py +169 -152
- {sentry_sdk-2.26.1.dist-info → sentry_sdk-3.0.0a1.dist-info}/METADATA +3 -5
- sentry_sdk-3.0.0a1.dist-info/RECORD +154 -0
- {sentry_sdk-2.26.1.dist-info → sentry_sdk-3.0.0a1.dist-info}/WHEEL +1 -1
- sentry_sdk-3.0.0a1.dist-info/entry_points.txt +2 -0
- sentry_sdk/hub.py +0 -739
- sentry_sdk/integrations/opentelemetry/__init__.py +0 -7
- sentry_sdk/integrations/opentelemetry/consts.py +0 -5
- sentry_sdk/integrations/opentelemetry/integration.py +0 -58
- sentry_sdk/integrations/opentelemetry/span_processor.py +0 -391
- sentry_sdk/metrics.py +0 -965
- sentry_sdk-2.26.1.dist-info/RECORD +0 -152
- sentry_sdk-2.26.1.dist-info/entry_points.txt +0 -2
- {sentry_sdk-2.26.1.dist-info → sentry_sdk-3.0.0a1.dist-info}/licenses/LICENSE +0 -0
- {sentry_sdk-2.26.1.dist-info → sentry_sdk-3.0.0a1.dist-info}/top_level.txt +0 -0
sentry_sdk/sessions.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import time
|
|
3
|
-
import warnings
|
|
4
3
|
from threading import Thread, Lock
|
|
5
4
|
from contextlib import contextmanager
|
|
6
5
|
|
|
@@ -18,75 +17,6 @@ if TYPE_CHECKING:
|
|
|
18
17
|
from typing import Generator
|
|
19
18
|
from typing import List
|
|
20
19
|
from typing import Optional
|
|
21
|
-
from typing import Union
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def is_auto_session_tracking_enabled(hub=None):
|
|
25
|
-
# type: (Optional[sentry_sdk.Hub]) -> Union[Any, bool, None]
|
|
26
|
-
"""DEPRECATED: Utility function to find out if session tracking is enabled."""
|
|
27
|
-
|
|
28
|
-
# Internal callers should use private _is_auto_session_tracking_enabled, instead.
|
|
29
|
-
warnings.warn(
|
|
30
|
-
"This function is deprecated and will be removed in the next major release. "
|
|
31
|
-
"There is no public API replacement.",
|
|
32
|
-
DeprecationWarning,
|
|
33
|
-
stacklevel=2,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
if hub is None:
|
|
37
|
-
hub = sentry_sdk.Hub.current
|
|
38
|
-
|
|
39
|
-
should_track = hub.scope._force_auto_session_tracking
|
|
40
|
-
|
|
41
|
-
if should_track is None:
|
|
42
|
-
client_options = hub.client.options if hub.client else {}
|
|
43
|
-
should_track = client_options.get("auto_session_tracking", False)
|
|
44
|
-
|
|
45
|
-
return should_track
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
@contextmanager
|
|
49
|
-
def auto_session_tracking(hub=None, session_mode="application"):
|
|
50
|
-
# type: (Optional[sentry_sdk.Hub], str) -> Generator[None, None, None]
|
|
51
|
-
"""DEPRECATED: Use track_session instead
|
|
52
|
-
Starts and stops a session automatically around a block.
|
|
53
|
-
"""
|
|
54
|
-
warnings.warn(
|
|
55
|
-
"This function is deprecated and will be removed in the next major release. "
|
|
56
|
-
"Use track_session instead.",
|
|
57
|
-
DeprecationWarning,
|
|
58
|
-
stacklevel=2,
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
if hub is None:
|
|
62
|
-
hub = sentry_sdk.Hub.current
|
|
63
|
-
with warnings.catch_warnings():
|
|
64
|
-
warnings.simplefilter("ignore", DeprecationWarning)
|
|
65
|
-
should_track = is_auto_session_tracking_enabled(hub)
|
|
66
|
-
if should_track:
|
|
67
|
-
hub.start_session(session_mode=session_mode)
|
|
68
|
-
try:
|
|
69
|
-
yield
|
|
70
|
-
finally:
|
|
71
|
-
if should_track:
|
|
72
|
-
hub.end_session()
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def is_auto_session_tracking_enabled_scope(scope):
|
|
76
|
-
# type: (sentry_sdk.Scope) -> bool
|
|
77
|
-
"""
|
|
78
|
-
DEPRECATED: Utility function to find out if session tracking is enabled.
|
|
79
|
-
"""
|
|
80
|
-
|
|
81
|
-
warnings.warn(
|
|
82
|
-
"This function is deprecated and will be removed in the next major release. "
|
|
83
|
-
"There is no public API replacement.",
|
|
84
|
-
DeprecationWarning,
|
|
85
|
-
stacklevel=2,
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
# Internal callers should use private _is_auto_session_tracking_enabled, instead.
|
|
89
|
-
return _is_auto_session_tracking_enabled(scope)
|
|
90
20
|
|
|
91
21
|
|
|
92
22
|
def _is_auto_session_tracking_enabled(scope):
|
|
@@ -103,23 +33,6 @@ def _is_auto_session_tracking_enabled(scope):
|
|
|
103
33
|
return should_track
|
|
104
34
|
|
|
105
35
|
|
|
106
|
-
@contextmanager
|
|
107
|
-
def auto_session_tracking_scope(scope, session_mode="application"):
|
|
108
|
-
# type: (sentry_sdk.Scope, str) -> Generator[None, None, None]
|
|
109
|
-
"""DEPRECATED: This function is a deprecated alias for track_session.
|
|
110
|
-
Starts and stops a session automatically around a block.
|
|
111
|
-
"""
|
|
112
|
-
|
|
113
|
-
warnings.warn(
|
|
114
|
-
"This function is a deprecated alias for track_session and will be removed in the next major release.",
|
|
115
|
-
DeprecationWarning,
|
|
116
|
-
stacklevel=2,
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
with track_session(scope, session_mode=session_mode):
|
|
120
|
-
yield
|
|
121
|
-
|
|
122
|
-
|
|
123
36
|
@contextmanager
|
|
124
37
|
def track_session(scope, session_mode="application"):
|
|
125
38
|
# type: (sentry_sdk.Scope, str) -> Generator[None, None, None]
|