sentry-sdk 0.18.0__py2.py3-none-any.whl → 2.46.0__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.
Files changed (193) hide show
  1. sentry_sdk/__init__.py +48 -6
  2. sentry_sdk/_compat.py +64 -56
  3. sentry_sdk/_init_implementation.py +84 -0
  4. sentry_sdk/_log_batcher.py +172 -0
  5. sentry_sdk/_lru_cache.py +47 -0
  6. sentry_sdk/_metrics_batcher.py +167 -0
  7. sentry_sdk/_queue.py +81 -19
  8. sentry_sdk/_types.py +311 -11
  9. sentry_sdk/_werkzeug.py +98 -0
  10. sentry_sdk/ai/__init__.py +7 -0
  11. sentry_sdk/ai/monitoring.py +137 -0
  12. sentry_sdk/ai/utils.py +144 -0
  13. sentry_sdk/api.py +409 -67
  14. sentry_sdk/attachments.py +75 -0
  15. sentry_sdk/client.py +849 -103
  16. sentry_sdk/consts.py +1389 -34
  17. sentry_sdk/crons/__init__.py +10 -0
  18. sentry_sdk/crons/api.py +62 -0
  19. sentry_sdk/crons/consts.py +4 -0
  20. sentry_sdk/crons/decorator.py +135 -0
  21. sentry_sdk/debug.py +12 -15
  22. sentry_sdk/envelope.py +112 -61
  23. sentry_sdk/feature_flags.py +71 -0
  24. sentry_sdk/hub.py +442 -386
  25. sentry_sdk/integrations/__init__.py +228 -58
  26. sentry_sdk/integrations/_asgi_common.py +108 -0
  27. sentry_sdk/integrations/_wsgi_common.py +131 -40
  28. sentry_sdk/integrations/aiohttp.py +221 -72
  29. sentry_sdk/integrations/anthropic.py +439 -0
  30. sentry_sdk/integrations/argv.py +4 -6
  31. sentry_sdk/integrations/ariadne.py +161 -0
  32. sentry_sdk/integrations/arq.py +247 -0
  33. sentry_sdk/integrations/asgi.py +237 -135
  34. sentry_sdk/integrations/asyncio.py +144 -0
  35. sentry_sdk/integrations/asyncpg.py +208 -0
  36. sentry_sdk/integrations/atexit.py +13 -18
  37. sentry_sdk/integrations/aws_lambda.py +233 -80
  38. sentry_sdk/integrations/beam.py +27 -35
  39. sentry_sdk/integrations/boto3.py +137 -0
  40. sentry_sdk/integrations/bottle.py +91 -69
  41. sentry_sdk/integrations/celery/__init__.py +529 -0
  42. sentry_sdk/integrations/celery/beat.py +293 -0
  43. sentry_sdk/integrations/celery/utils.py +43 -0
  44. sentry_sdk/integrations/chalice.py +35 -28
  45. sentry_sdk/integrations/clickhouse_driver.py +177 -0
  46. sentry_sdk/integrations/cloud_resource_context.py +280 -0
  47. sentry_sdk/integrations/cohere.py +274 -0
  48. sentry_sdk/integrations/dedupe.py +32 -8
  49. sentry_sdk/integrations/django/__init__.py +343 -89
  50. sentry_sdk/integrations/django/asgi.py +201 -22
  51. sentry_sdk/integrations/django/caching.py +204 -0
  52. sentry_sdk/integrations/django/middleware.py +80 -32
  53. sentry_sdk/integrations/django/signals_handlers.py +91 -0
  54. sentry_sdk/integrations/django/templates.py +69 -2
  55. sentry_sdk/integrations/django/transactions.py +39 -14
  56. sentry_sdk/integrations/django/views.py +69 -16
  57. sentry_sdk/integrations/dramatiq.py +226 -0
  58. sentry_sdk/integrations/excepthook.py +19 -13
  59. sentry_sdk/integrations/executing.py +5 -6
  60. sentry_sdk/integrations/falcon.py +128 -65
  61. sentry_sdk/integrations/fastapi.py +141 -0
  62. sentry_sdk/integrations/flask.py +114 -75
  63. sentry_sdk/integrations/gcp.py +67 -36
  64. sentry_sdk/integrations/gnu_backtrace.py +14 -22
  65. sentry_sdk/integrations/google_genai/__init__.py +301 -0
  66. sentry_sdk/integrations/google_genai/consts.py +16 -0
  67. sentry_sdk/integrations/google_genai/streaming.py +155 -0
  68. sentry_sdk/integrations/google_genai/utils.py +576 -0
  69. sentry_sdk/integrations/gql.py +162 -0
  70. sentry_sdk/integrations/graphene.py +151 -0
  71. sentry_sdk/integrations/grpc/__init__.py +168 -0
  72. sentry_sdk/integrations/grpc/aio/__init__.py +7 -0
  73. sentry_sdk/integrations/grpc/aio/client.py +95 -0
  74. sentry_sdk/integrations/grpc/aio/server.py +100 -0
  75. sentry_sdk/integrations/grpc/client.py +91 -0
  76. sentry_sdk/integrations/grpc/consts.py +1 -0
  77. sentry_sdk/integrations/grpc/server.py +66 -0
  78. sentry_sdk/integrations/httpx.py +178 -0
  79. sentry_sdk/integrations/huey.py +174 -0
  80. sentry_sdk/integrations/huggingface_hub.py +378 -0
  81. sentry_sdk/integrations/langchain.py +1132 -0
  82. sentry_sdk/integrations/langgraph.py +337 -0
  83. sentry_sdk/integrations/launchdarkly.py +61 -0
  84. sentry_sdk/integrations/litellm.py +287 -0
  85. sentry_sdk/integrations/litestar.py +315 -0
  86. sentry_sdk/integrations/logging.py +261 -85
  87. sentry_sdk/integrations/loguru.py +213 -0
  88. sentry_sdk/integrations/mcp.py +566 -0
  89. sentry_sdk/integrations/modules.py +6 -33
  90. sentry_sdk/integrations/openai.py +725 -0
  91. sentry_sdk/integrations/openai_agents/__init__.py +61 -0
  92. sentry_sdk/integrations/openai_agents/consts.py +1 -0
  93. sentry_sdk/integrations/openai_agents/patches/__init__.py +5 -0
  94. sentry_sdk/integrations/openai_agents/patches/agent_run.py +140 -0
  95. sentry_sdk/integrations/openai_agents/patches/error_tracing.py +77 -0
  96. sentry_sdk/integrations/openai_agents/patches/models.py +50 -0
  97. sentry_sdk/integrations/openai_agents/patches/runner.py +45 -0
  98. sentry_sdk/integrations/openai_agents/patches/tools.py +77 -0
  99. sentry_sdk/integrations/openai_agents/spans/__init__.py +5 -0
  100. sentry_sdk/integrations/openai_agents/spans/agent_workflow.py +21 -0
  101. sentry_sdk/integrations/openai_agents/spans/ai_client.py +42 -0
  102. sentry_sdk/integrations/openai_agents/spans/execute_tool.py +48 -0
  103. sentry_sdk/integrations/openai_agents/spans/handoff.py +19 -0
  104. sentry_sdk/integrations/openai_agents/spans/invoke_agent.py +86 -0
  105. sentry_sdk/integrations/openai_agents/utils.py +199 -0
  106. sentry_sdk/integrations/openfeature.py +35 -0
  107. sentry_sdk/integrations/opentelemetry/__init__.py +7 -0
  108. sentry_sdk/integrations/opentelemetry/consts.py +5 -0
  109. sentry_sdk/integrations/opentelemetry/integration.py +58 -0
  110. sentry_sdk/integrations/opentelemetry/propagator.py +117 -0
  111. sentry_sdk/integrations/opentelemetry/span_processor.py +391 -0
  112. sentry_sdk/integrations/otlp.py +82 -0
  113. sentry_sdk/integrations/pure_eval.py +20 -11
  114. sentry_sdk/integrations/pydantic_ai/__init__.py +47 -0
  115. sentry_sdk/integrations/pydantic_ai/consts.py +1 -0
  116. sentry_sdk/integrations/pydantic_ai/patches/__init__.py +4 -0
  117. sentry_sdk/integrations/pydantic_ai/patches/agent_run.py +215 -0
  118. sentry_sdk/integrations/pydantic_ai/patches/graph_nodes.py +110 -0
  119. sentry_sdk/integrations/pydantic_ai/patches/model_request.py +40 -0
  120. sentry_sdk/integrations/pydantic_ai/patches/tools.py +98 -0
  121. sentry_sdk/integrations/pydantic_ai/spans/__init__.py +3 -0
  122. sentry_sdk/integrations/pydantic_ai/spans/ai_client.py +246 -0
  123. sentry_sdk/integrations/pydantic_ai/spans/execute_tool.py +49 -0
  124. sentry_sdk/integrations/pydantic_ai/spans/invoke_agent.py +112 -0
  125. sentry_sdk/integrations/pydantic_ai/utils.py +223 -0
  126. sentry_sdk/integrations/pymongo.py +214 -0
  127. sentry_sdk/integrations/pyramid.py +71 -60
  128. sentry_sdk/integrations/quart.py +237 -0
  129. sentry_sdk/integrations/ray.py +165 -0
  130. sentry_sdk/integrations/redis/__init__.py +48 -0
  131. sentry_sdk/integrations/redis/_async_common.py +116 -0
  132. sentry_sdk/integrations/redis/_sync_common.py +119 -0
  133. sentry_sdk/integrations/redis/consts.py +19 -0
  134. sentry_sdk/integrations/redis/modules/__init__.py +0 -0
  135. sentry_sdk/integrations/redis/modules/caches.py +118 -0
  136. sentry_sdk/integrations/redis/modules/queries.py +65 -0
  137. sentry_sdk/integrations/redis/rb.py +32 -0
  138. sentry_sdk/integrations/redis/redis.py +69 -0
  139. sentry_sdk/integrations/redis/redis_cluster.py +107 -0
  140. sentry_sdk/integrations/redis/redis_py_cluster_legacy.py +50 -0
  141. sentry_sdk/integrations/redis/utils.py +148 -0
  142. sentry_sdk/integrations/rq.py +62 -52
  143. sentry_sdk/integrations/rust_tracing.py +284 -0
  144. sentry_sdk/integrations/sanic.py +248 -114
  145. sentry_sdk/integrations/serverless.py +13 -22
  146. sentry_sdk/integrations/socket.py +96 -0
  147. sentry_sdk/integrations/spark/spark_driver.py +115 -62
  148. sentry_sdk/integrations/spark/spark_worker.py +42 -50
  149. sentry_sdk/integrations/sqlalchemy.py +82 -37
  150. sentry_sdk/integrations/starlette.py +737 -0
  151. sentry_sdk/integrations/starlite.py +292 -0
  152. sentry_sdk/integrations/statsig.py +37 -0
  153. sentry_sdk/integrations/stdlib.py +100 -58
  154. sentry_sdk/integrations/strawberry.py +394 -0
  155. sentry_sdk/integrations/sys_exit.py +70 -0
  156. sentry_sdk/integrations/threading.py +142 -38
  157. sentry_sdk/integrations/tornado.py +68 -53
  158. sentry_sdk/integrations/trytond.py +15 -20
  159. sentry_sdk/integrations/typer.py +60 -0
  160. sentry_sdk/integrations/unleash.py +33 -0
  161. sentry_sdk/integrations/unraisablehook.py +53 -0
  162. sentry_sdk/integrations/wsgi.py +126 -125
  163. sentry_sdk/logger.py +96 -0
  164. sentry_sdk/metrics.py +81 -0
  165. sentry_sdk/monitor.py +120 -0
  166. sentry_sdk/profiler/__init__.py +49 -0
  167. sentry_sdk/profiler/continuous_profiler.py +730 -0
  168. sentry_sdk/profiler/transaction_profiler.py +839 -0
  169. sentry_sdk/profiler/utils.py +195 -0
  170. sentry_sdk/scope.py +1542 -112
  171. sentry_sdk/scrubber.py +177 -0
  172. sentry_sdk/serializer.py +152 -210
  173. sentry_sdk/session.py +177 -0
  174. sentry_sdk/sessions.py +202 -179
  175. sentry_sdk/spotlight.py +242 -0
  176. sentry_sdk/tracing.py +1202 -294
  177. sentry_sdk/tracing_utils.py +1236 -0
  178. sentry_sdk/transport.py +693 -189
  179. sentry_sdk/types.py +52 -0
  180. sentry_sdk/utils.py +1395 -228
  181. sentry_sdk/worker.py +30 -17
  182. sentry_sdk-2.46.0.dist-info/METADATA +268 -0
  183. sentry_sdk-2.46.0.dist-info/RECORD +189 -0
  184. {sentry_sdk-0.18.0.dist-info → sentry_sdk-2.46.0.dist-info}/WHEEL +1 -1
  185. sentry_sdk-2.46.0.dist-info/entry_points.txt +2 -0
  186. sentry_sdk-2.46.0.dist-info/licenses/LICENSE +21 -0
  187. sentry_sdk/_functools.py +0 -66
  188. sentry_sdk/integrations/celery.py +0 -275
  189. sentry_sdk/integrations/redis.py +0 -103
  190. sentry_sdk-0.18.0.dist-info/LICENSE +0 -9
  191. sentry_sdk-0.18.0.dist-info/METADATA +0 -66
  192. sentry_sdk-0.18.0.dist-info/RECORD +0 -65
  193. {sentry_sdk-0.18.0.dist-info → sentry_sdk-2.46.0.dist-info}/top_level.txt +0 -0
@@ -1,275 +0,0 @@
1
- from __future__ import absolute_import
2
-
3
- import sys
4
-
5
- from sentry_sdk.hub import Hub
6
- from sentry_sdk.utils import capture_internal_exceptions, event_from_exception
7
- from sentry_sdk.tracing import Transaction
8
- from sentry_sdk._compat import reraise
9
- from sentry_sdk.integrations import Integration, DidNotEnable
10
- from sentry_sdk.integrations.logging import ignore_logger
11
- from sentry_sdk._types import MYPY
12
- from sentry_sdk._functools import wraps
13
-
14
- if MYPY:
15
- from typing import Any
16
- from typing import TypeVar
17
- from typing import Callable
18
- from typing import Optional
19
-
20
- from sentry_sdk._types import EventProcessor, Event, Hint, ExcInfo
21
-
22
- F = TypeVar("F", bound=Callable[..., Any])
23
-
24
-
25
- try:
26
- from celery import VERSION as CELERY_VERSION # type: ignore
27
- from celery.exceptions import ( # type: ignore
28
- SoftTimeLimitExceeded,
29
- Retry,
30
- Ignore,
31
- Reject,
32
- )
33
- except ImportError:
34
- raise DidNotEnable("Celery not installed")
35
-
36
-
37
- CELERY_CONTROL_FLOW_EXCEPTIONS = (Retry, Ignore, Reject)
38
-
39
-
40
- class CeleryIntegration(Integration):
41
- identifier = "celery"
42
-
43
- def __init__(self, propagate_traces=True):
44
- # type: (bool) -> None
45
- self.propagate_traces = propagate_traces
46
-
47
- @staticmethod
48
- def setup_once():
49
- # type: () -> None
50
- if CELERY_VERSION < (3,):
51
- raise DidNotEnable("Celery 3 or newer required.")
52
-
53
- import celery.app.trace as trace # type: ignore
54
-
55
- old_build_tracer = trace.build_tracer
56
-
57
- def sentry_build_tracer(name, task, *args, **kwargs):
58
- # type: (Any, Any, *Any, **Any) -> Any
59
- if not getattr(task, "_sentry_is_patched", False):
60
- # Need to patch both methods because older celery sometimes
61
- # short-circuits to task.run if it thinks it's safe.
62
- task.__call__ = _wrap_task_call(task, task.__call__)
63
- task.run = _wrap_task_call(task, task.run)
64
-
65
- # `build_tracer` is apparently called for every task
66
- # invocation. Can't wrap every celery task for every invocation
67
- # or we will get infinitely nested wrapper functions.
68
- task._sentry_is_patched = True
69
-
70
- return _wrap_tracer(task, old_build_tracer(name, task, *args, **kwargs))
71
-
72
- trace.build_tracer = sentry_build_tracer
73
-
74
- from celery.app.task import Task # type: ignore
75
-
76
- Task.apply_async = _wrap_apply_async(Task.apply_async)
77
-
78
- _patch_worker_exit()
79
-
80
- # This logger logs every status of every task that ran on the worker.
81
- # Meaning that every task's breadcrumbs are full of stuff like "Task
82
- # <foo> raised unexpected <bar>".
83
- ignore_logger("celery.worker.job")
84
- ignore_logger("celery.app.trace")
85
-
86
- # This is stdout/err redirected to a logger, can't deal with this
87
- # (need event_level=logging.WARN to reproduce)
88
- ignore_logger("celery.redirected")
89
-
90
-
91
- def _wrap_apply_async(f):
92
- # type: (F) -> F
93
- @wraps(f)
94
- def apply_async(*args, **kwargs):
95
- # type: (*Any, **Any) -> Any
96
- hub = Hub.current
97
- integration = hub.get_integration(CeleryIntegration)
98
- if integration is not None and integration.propagate_traces:
99
- with hub.start_span(op="celery.submit", description=args[0].name):
100
- with capture_internal_exceptions():
101
- headers = dict(hub.iter_trace_propagation_headers())
102
-
103
- if headers:
104
- # Note: kwargs can contain headers=None, so no setdefault!
105
- # Unsure which backend though.
106
- kwarg_headers = kwargs.get("headers") or {}
107
- kwarg_headers.update(headers)
108
-
109
- # https://github.com/celery/celery/issues/4875
110
- #
111
- # Need to setdefault the inner headers too since other
112
- # tracing tools (dd-trace-py) also employ this exact
113
- # workaround and we don't want to break them.
114
- kwarg_headers.setdefault("headers", {}).update(headers)
115
- kwargs["headers"] = kwarg_headers
116
-
117
- return f(*args, **kwargs)
118
- else:
119
- return f(*args, **kwargs)
120
-
121
- return apply_async # type: ignore
122
-
123
-
124
- def _wrap_tracer(task, f):
125
- # type: (Any, F) -> F
126
-
127
- # Need to wrap tracer for pushing the scope before prerun is sent, and
128
- # popping it after postrun is sent.
129
- #
130
- # This is the reason we don't use signals for hooking in the first place.
131
- # Also because in Celery 3, signal dispatch returns early if one handler
132
- # crashes.
133
- @wraps(f)
134
- def _inner(*args, **kwargs):
135
- # type: (*Any, **Any) -> Any
136
- hub = Hub.current
137
- if hub.get_integration(CeleryIntegration) is None:
138
- return f(*args, **kwargs)
139
-
140
- with hub.push_scope() as scope:
141
- scope._name = "celery"
142
- scope.clear_breadcrumbs()
143
- scope.add_event_processor(_make_event_processor(task, *args, **kwargs))
144
-
145
- transaction = None
146
-
147
- # Celery task objects are not a thing to be trusted. Even
148
- # something such as attribute access can fail.
149
- with capture_internal_exceptions():
150
- transaction = Transaction.continue_from_headers(
151
- args[3].get("headers") or {},
152
- op="celery.task",
153
- name="unknown celery task",
154
- )
155
-
156
- transaction.name = task.name
157
- transaction.set_status("ok")
158
-
159
- if transaction is None:
160
- return f(*args, **kwargs)
161
-
162
- with hub.start_transaction(transaction):
163
- return f(*args, **kwargs)
164
-
165
- return _inner # type: ignore
166
-
167
-
168
- def _wrap_task_call(task, f):
169
- # type: (Any, F) -> F
170
-
171
- # Need to wrap task call because the exception is caught before we get to
172
- # see it. Also celery's reported stacktrace is untrustworthy.
173
-
174
- # functools.wraps is important here because celery-once looks at this
175
- # method's name.
176
- # https://github.com/getsentry/sentry-python/issues/421
177
- @wraps(f)
178
- def _inner(*args, **kwargs):
179
- # type: (*Any, **Any) -> Any
180
- try:
181
- return f(*args, **kwargs)
182
- except Exception:
183
- exc_info = sys.exc_info()
184
- with capture_internal_exceptions():
185
- _capture_exception(task, exc_info)
186
- reraise(*exc_info)
187
-
188
- return _inner # type: ignore
189
-
190
-
191
- def _make_event_processor(task, uuid, args, kwargs, request=None):
192
- # type: (Any, Any, Any, Any, Optional[Any]) -> EventProcessor
193
- def event_processor(event, hint):
194
- # type: (Event, Hint) -> Optional[Event]
195
-
196
- with capture_internal_exceptions():
197
- tags = event.setdefault("tags", {})
198
- tags["celery_task_id"] = uuid
199
- extra = event.setdefault("extra", {})
200
- extra["celery-job"] = {
201
- "task_name": task.name,
202
- "args": args,
203
- "kwargs": kwargs,
204
- }
205
-
206
- if "exc_info" in hint:
207
- with capture_internal_exceptions():
208
- if issubclass(hint["exc_info"][0], SoftTimeLimitExceeded):
209
- event["fingerprint"] = [
210
- "celery",
211
- "SoftTimeLimitExceeded",
212
- getattr(task, "name", task),
213
- ]
214
-
215
- return event
216
-
217
- return event_processor
218
-
219
-
220
- def _capture_exception(task, exc_info):
221
- # type: (Any, ExcInfo) -> None
222
- hub = Hub.current
223
-
224
- if hub.get_integration(CeleryIntegration) is None:
225
- return
226
- if isinstance(exc_info[1], CELERY_CONTROL_FLOW_EXCEPTIONS):
227
- # ??? Doesn't map to anything
228
- _set_status(hub, "aborted")
229
- return
230
-
231
- _set_status(hub, "internal_error")
232
-
233
- if hasattr(task, "throws") and isinstance(exc_info[1], task.throws):
234
- return
235
-
236
- # If an integration is there, a client has to be there.
237
- client = hub.client # type: Any
238
-
239
- event, hint = event_from_exception(
240
- exc_info,
241
- client_options=client.options,
242
- mechanism={"type": "celery", "handled": False},
243
- )
244
-
245
- hub.capture_event(event, hint=hint)
246
-
247
-
248
- def _set_status(hub, status):
249
- # type: (Hub, str) -> None
250
- with capture_internal_exceptions():
251
- with hub.configure_scope() as scope:
252
- if scope.span is not None:
253
- scope.span.set_status(status)
254
-
255
-
256
- def _patch_worker_exit():
257
- # type: () -> None
258
-
259
- # Need to flush queue before worker shutdown because a crashing worker will
260
- # call os._exit
261
- from billiard.pool import Worker # type: ignore
262
-
263
- old_workloop = Worker.workloop
264
-
265
- def sentry_workloop(*args, **kwargs):
266
- # type: (*Any, **Any) -> Any
267
- try:
268
- return old_workloop(*args, **kwargs)
269
- finally:
270
- with capture_internal_exceptions():
271
- hub = Hub.current
272
- if hub.get_integration(CeleryIntegration) is not None:
273
- hub.flush()
274
-
275
- Worker.workloop = sentry_workloop
@@ -1,103 +0,0 @@
1
- from __future__ import absolute_import
2
-
3
- from sentry_sdk import Hub
4
- from sentry_sdk.utils import capture_internal_exceptions, logger
5
- from sentry_sdk.integrations import Integration
6
-
7
- from sentry_sdk._types import MYPY
8
-
9
- if MYPY:
10
- from typing import Any
11
-
12
- _SINGLE_KEY_COMMANDS = frozenset(
13
- ["decr", "decrby", "get", "incr", "incrby", "pttl", "set", "setex", "setnx", "ttl"]
14
- )
15
- _MULTI_KEY_COMMANDS = frozenset(["del", "touch", "unlink"])
16
-
17
-
18
- def _patch_rediscluster():
19
- # type: () -> None
20
- try:
21
- import rediscluster # type: ignore
22
- except ImportError:
23
- return
24
-
25
- patch_redis_client(rediscluster.RedisCluster)
26
-
27
- # up to v1.3.6, __version__ attribute is a tuple
28
- # from v2.0.0, __version__ is a string and VERSION a tuple
29
- version = getattr(rediscluster, "VERSION", rediscluster.__version__)
30
-
31
- # StrictRedisCluster was introduced in v0.2.0 and removed in v2.0.0
32
- # https://github.com/Grokzen/redis-py-cluster/blob/master/docs/release-notes.rst
33
- if (0, 2, 0) < version < (2, 0, 0):
34
- patch_redis_client(rediscluster.StrictRedisCluster)
35
-
36
-
37
- class RedisIntegration(Integration):
38
- identifier = "redis"
39
-
40
- @staticmethod
41
- def setup_once():
42
- # type: () -> None
43
- import redis
44
-
45
- patch_redis_client(redis.StrictRedis)
46
-
47
- try:
48
- import rb.clients # type: ignore
49
- except ImportError:
50
- pass
51
- else:
52
- patch_redis_client(rb.clients.FanoutClient)
53
- patch_redis_client(rb.clients.MappingClient)
54
- patch_redis_client(rb.clients.RoutingClient)
55
-
56
- try:
57
- _patch_rediscluster()
58
- except Exception:
59
- logger.exception("Error occured while patching `rediscluster` library")
60
-
61
-
62
- def patch_redis_client(cls):
63
- # type: (Any) -> None
64
- """
65
- This function can be used to instrument custom redis client classes or
66
- subclasses.
67
- """
68
-
69
- old_execute_command = cls.execute_command
70
-
71
- def sentry_patched_execute_command(self, name, *args, **kwargs):
72
- # type: (Any, str, *Any, **Any) -> Any
73
- hub = Hub.current
74
-
75
- if hub.get_integration(RedisIntegration) is None:
76
- return old_execute_command(self, name, *args, **kwargs)
77
-
78
- description = name
79
-
80
- with capture_internal_exceptions():
81
- description_parts = [name]
82
- for i, arg in enumerate(args):
83
- if i > 10:
84
- break
85
-
86
- description_parts.append(repr(arg))
87
-
88
- description = " ".join(description_parts)
89
-
90
- with hub.start_span(op="redis", description=description) as span:
91
- if name:
92
- span.set_tag("redis.command", name)
93
-
94
- if name and args:
95
- name_low = name.lower()
96
- if (name_low in _SINGLE_KEY_COMMANDS) or (
97
- name_low in _MULTI_KEY_COMMANDS and len(args) == 1
98
- ):
99
- span.set_tag("redis.key", args[0])
100
-
101
- return old_execute_command(self, name, *args, **kwargs)
102
-
103
- cls.execute_command = sentry_patched_execute_command
@@ -1,9 +0,0 @@
1
- Copyright (c) 2018 Sentry (https://sentry.io) and individual contributors.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
-
9
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,66 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: sentry-sdk
3
- Version: 0.18.0
4
- Summary: Python client for Sentry (https://sentry.io)
5
- Home-page: https://github.com/getsentry/sentry-python
6
- Author: Sentry Team and Contributors
7
- Author-email: hello@sentry.io
8
- License: BSD
9
- Platform: UNKNOWN
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Environment :: Web Environment
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: BSD License
14
- Classifier: Operating System :: OS Independent
15
- Classifier: Programming Language :: Python
16
- Classifier: Programming Language :: Python :: 2
17
- Classifier: Programming Language :: Python :: 2.7
18
- Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.4
20
- Classifier: Programming Language :: Python :: 3.5
21
- Classifier: Programming Language :: Python :: 3.6
22
- Classifier: Programming Language :: Python :: 3.7
23
- Classifier: Programming Language :: Python :: 3.8
24
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
- Requires-Dist: urllib3 (>=1.10.0)
26
- Requires-Dist: certifi
27
- Provides-Extra: aiohttp
28
- Requires-Dist: aiohttp (>=3.5) ; extra == 'aiohttp'
29
- Provides-Extra: beam
30
- Requires-Dist: apache-beam (>=2.12) ; extra == 'beam'
31
- Provides-Extra: bottle
32
- Requires-Dist: bottle (>=0.12.13) ; extra == 'bottle'
33
- Provides-Extra: celery
34
- Requires-Dist: celery (>=3) ; extra == 'celery'
35
- Provides-Extra: chalice
36
- Requires-Dist: chalice (>=1.16.0) ; extra == 'chalice'
37
- Provides-Extra: django
38
- Requires-Dist: django (>=1.8) ; extra == 'django'
39
- Provides-Extra: falcon
40
- Requires-Dist: falcon (>=1.4) ; extra == 'falcon'
41
- Provides-Extra: flask
42
- Requires-Dist: flask (>=0.11) ; extra == 'flask'
43
- Requires-Dist: blinker (>=1.1) ; extra == 'flask'
44
- Provides-Extra: pure_eval
45
- Requires-Dist: pure-eval ; extra == 'pure_eval'
46
- Requires-Dist: executing ; extra == 'pure_eval'
47
- Requires-Dist: asttokens ; extra == 'pure_eval'
48
- Provides-Extra: pyspark
49
- Requires-Dist: pyspark (>=2.4.4) ; extra == 'pyspark'
50
- Provides-Extra: rq
51
- Requires-Dist: rq (>=0.6) ; extra == 'rq'
52
- Provides-Extra: sanic
53
- Requires-Dist: sanic (>=0.8) ; extra == 'sanic'
54
- Provides-Extra: sqlalchemy
55
- Requires-Dist: sqlalchemy (>=1.2) ; extra == 'sqlalchemy'
56
- Provides-Extra: tornado
57
- Requires-Dist: tornado (>=5) ; extra == 'tornado'
58
-
59
-
60
- Sentry-Python - Sentry SDK for Python
61
- =====================================
62
-
63
- **Sentry-Python is an SDK for Sentry.** Check out `GitHub
64
- <https://github.com/getsentry/sentry-python>`_ to find out more.
65
-
66
-
@@ -1,65 +0,0 @@
1
- sentry_sdk/__init__.py,sha256=k1HZ_Malhx3a5bIh4pAl4Tvt_hAopZhyR5lcRR0enX0,591
2
- sentry_sdk/_compat.py,sha256=Bc6t13KT42UyDTUXiWFX-Y9Yt8WPcc-ePEiCku0YPmc,2360
3
- sentry_sdk/_functools.py,sha256=D3F8E4wEAq74HDVyP9OmyUm9fvN-gQStlr9ptjcDBXU,2276
4
- sentry_sdk/_queue.py,sha256=cxxtD-R_OE2hKptVVXBXZrXhqkxiMBJxvpePcF1z-d0,8403
5
- sentry_sdk/_types.py,sha256=83W3io6aKhuwLLS2-522CpK30ojqNwL-GSOw8XO5kv8,1128
6
- sentry_sdk/api.py,sha256=2p-3_ponyA_mzcGECuiv5YZir4rxSUeOpakeFqtRgKs,4740
7
- sentry_sdk/client.py,sha256=s7DwgowTvPnmbwU7PRk9Fx0crTgpJDT2wU4REy1eQ88,14127
8
- sentry_sdk/consts.py,sha256=vP5qCM66GiTGItwzYkc5w4rsrm_rtix5YENTYFtosxQ,3407
9
- sentry_sdk/debug.py,sha256=ZT-7VoCIA5TYhh7X-ZSaSzYZ4_MuoNvzi12gKgIKzm0,1132
10
- sentry_sdk/envelope.py,sha256=HsUlvqau5j_OLuSvpSWa_udiWwGdI0-pxh1VrFSbUfw,8954
11
- sentry_sdk/hub.py,sha256=262-Yxmq_-0VghylTxU0_Qsdj-ieGd2WeW92YcST8yc,21439
12
- sentry_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- sentry_sdk/scope.py,sha256=nmvRJaRLiCmvHIVt_LYDgK0KTMwB3MHi2BbRUUAa6Ck,13948
14
- sentry_sdk/serializer.py,sha256=SDaQriSyMcZUTs5jCSzm1iSFlOTsTTF4v2aZAoVgIaU,16283
15
- sentry_sdk/sessions.py,sha256=YOwRW81wuu5Ih72KKpSTCg6f1LF6Px5OzNWEATmJNg4,7849
16
- sentry_sdk/tracing.py,sha256=DWq_0U_DvCkzl6ZP_dzZqev4KfMafB0TKfkMobLqot4,17856
17
- sentry_sdk/transport.py,sha256=Kv83uIQzVSciPVZN1JcjY3kF4ackVMuNyFSqB7jDcLc,11752
18
- sentry_sdk/utils.py,sha256=nJQ2ZOrVcU3XK2nqPkafdW5APiT4yUQrgkeYNr3Fmqk,25454
19
- sentry_sdk/worker.py,sha256=lAI-MO5HRF8_8ehIzsZpJsPxFFbDhmwp3wyVMyLIO_c,3961
20
- sentry_sdk/integrations/__init__.py,sha256=h5vlKWtuSLICjrzIFRL18pe2o74u_ZJHJ9xCbnfslS0,6455
21
- sentry_sdk/integrations/_wsgi_common.py,sha256=J8jlafU5yhQu2xjKuK_3-Bt9HbqbHIP5ZyWebkfSJ_k,4763
22
- sentry_sdk/integrations/aiohttp.py,sha256=Psk1HzgLLD29czxLGNiDzixZvTTthc0jt44fNdjQkag,6964
23
- sentry_sdk/integrations/argv.py,sha256=X-RVfWNxuPObsOmuommDc4FcIhNSTKpGsD1cYbrqza4,945
24
- sentry_sdk/integrations/asgi.py,sha256=ZhMEAWp8gsiJukqU4fL5wKMvRCQrpvp0WM9OVMg6IUs,8368
25
- sentry_sdk/integrations/atexit.py,sha256=b75c2SBJPl_cS4ObiQT1SMKqeZG5Fqed61z2myHRKug,1837
26
- sentry_sdk/integrations/aws_lambda.py,sha256=glBJfLyUpwbqVmgrywbw-0vzgPGXsrGuKfd1JM0EBSk,12767
27
- sentry_sdk/integrations/beam.py,sha256=g7F3X9-Zb6-AIooKln0NyQ4DaFw3gk5dEIXTNCl4B6A,5662
28
- sentry_sdk/integrations/bottle.py,sha256=W55vAqOev8ISmZ1LyxUckB1D3-WYdv90WP9fWEamFUo,6187
29
- sentry_sdk/integrations/celery.py,sha256=AemrWwusGYGlsZbrMfmwIYB8_1UBdjsgtqDYHPkgEhk,9119
30
- sentry_sdk/integrations/chalice.py,sha256=Yb1htVavJgUcuE90sFd7dXHQxi-8r1BQdVBiYJyAtC8,4573
31
- sentry_sdk/integrations/dedupe.py,sha256=d3JaHlMJpeF9zqVmITSPcLPBEvr9aHRzIrlGyzqeNgs,1166
32
- sentry_sdk/integrations/excepthook.py,sha256=xapfrixgI14A-9dAW3Atbjv1w40WO8hUJm2HJVk0kv8,2190
33
- sentry_sdk/integrations/executing.py,sha256=nKkMDGp_FLzksaeRqUy_E3G-tbvoJkeYn6x_QCCwXuk,2023
34
- sentry_sdk/integrations/falcon.py,sha256=lrHtg1kW3VhR23u89deLomyYkvwDIKKp5OowydCcIZE,6796
35
- sentry_sdk/integrations/flask.py,sha256=qy4_tPQdbUQP0s6WgnQOtIpJF3EszidhfOdLWmbko40,7263
36
- sentry_sdk/integrations/gcp.py,sha256=_gt0u1B0oNs8Jnmg8UTJhcDAes2mCKb5F7CVkBztznM,7259
37
- sentry_sdk/integrations/gnu_backtrace.py,sha256=VJU3zYY7GUybAgIOEGF_P7i4V2R_jOnlSgTCS7XNto0,2912
38
- sentry_sdk/integrations/logging.py,sha256=5Xr_bYF63-r7YiHIvsolZGxMgkj6aduGXUjxTO4LMqc,7325
39
- sentry_sdk/integrations/modules.py,sha256=tgl4abSudtR03NBOjXCWJ08dHY5KlxUveX3mPUNosYk,1393
40
- sentry_sdk/integrations/pure_eval.py,sha256=Ks_HXWIuPLKBWqLO3bW9-xaeKdMlezQrXQ6B3v19cbE,4380
41
- sentry_sdk/integrations/pyramid.py,sha256=o53KZmFp3JDx8aXS_1wG6q6xgksFoHuImE1Le6jvcXw,7072
42
- sentry_sdk/integrations/redis.py,sha256=s9NQB4yQz2H5n__CJC1RelyfoDiFQEbK8bSuwgIsJdI,3075
43
- sentry_sdk/integrations/rq.py,sha256=xFklTcw2lRWxMgh9dnbaEAxU1XHqJNZlM5m95JuncIA,4791
44
- sentry_sdk/integrations/sanic.py,sha256=6AHe8LHx-0BCtYjJz-Rht4UL66s4CLYzNVyVnuYCCRU,7709
45
- sentry_sdk/integrations/serverless.py,sha256=sVIQewlLmF2QY5qiStRfMcbOiwh8OmNki6qIfb8sgEM,1971
46
- sentry_sdk/integrations/sqlalchemy.py,sha256=_8z8gVd7VwJHDndcrG-igpmRABCaS_YS4qOsCGYCwBE,2939
47
- sentry_sdk/integrations/stdlib.py,sha256=bYoNEOP_xmKgR-n_SmBLNAHhwC41y8l96go5aQX3gss,7348
48
- sentry_sdk/integrations/threading.py,sha256=TN5cmoLfRIaayFFWoN9L0VdXunB23iTcUjUA6V9GSrE,2856
49
- sentry_sdk/integrations/tornado.py,sha256=y8QZZSdcf1N_Cw90WmkAtFcy4VTPvM36EHLV-bds5B8,7001
50
- sentry_sdk/integrations/trytond.py,sha256=cLpQ5CZrG1Wn5Cq3_Xosswu5Jt43KEV-ag_zrvcXwqo,1728
51
- sentry_sdk/integrations/wsgi.py,sha256=FlC2RrfXAshAQdQjyfv4FAZVTNX5FNXwiijQdZaaIIM,10374
52
- sentry_sdk/integrations/django/__init__.py,sha256=RwGl36KVEHQEq3Ps3EKUbJvBqaP3IaIcTlvXYIthNGc,16087
53
- sentry_sdk/integrations/django/asgi.py,sha256=IUVB5-OWgkukpNz-bx0ZaoQPu_jiTKbnl3s3Pb7NfB4,2076
54
- sentry_sdk/integrations/django/middleware.py,sha256=5H-lQtTD_JXKvT_LaBspwgq7zcFKorOjVx949gR75yE,4591
55
- sentry_sdk/integrations/django/templates.py,sha256=Knq4W6NyfBbFGCLQqpB6mBCze2ZQJKmS4Up5Gvy47VU,3398
56
- sentry_sdk/integrations/django/transactions.py,sha256=1W-9xuryfy7ztqI_PLrSTAOWO0holUPyYuXYUh8ez2E,4094
57
- sentry_sdk/integrations/django/views.py,sha256=2rmAAgZWQZ1anZtx5kHPSCzbhmZLLajDcgLTwgq158I,1394
58
- sentry_sdk/integrations/spark/__init__.py,sha256=oOewMErnZk2rzNvIlZO6URxQexu9bUJuSLM2m_zECy8,208
59
- sentry_sdk/integrations/spark/spark_driver.py,sha256=CMyEe6_Qf8E9OSz3bcCumsOgO8eJ4egKOrazOYPcvX4,8465
60
- sentry_sdk/integrations/spark/spark_worker.py,sha256=VJmdo7titY08o-OQLEz7NIYaeTke8_aAgrGNC1nybmE,3980
61
- sentry_sdk-0.18.0.dist-info/LICENSE,sha256=WUBNTIVOV5CX1Bv8zVAGr96dbXDmRs9VB0zb_q1ezxw,1330
62
- sentry_sdk-0.18.0.dist-info/METADATA,sha256=lfTJRnCb28hxQ3xTd6XQfyNlCsoO_9yRLB_ylteBGJs,2458
63
- sentry_sdk-0.18.0.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rceP4,110
64
- sentry_sdk-0.18.0.dist-info/top_level.txt,sha256=XrQz30XE9FKXSY_yGLrd9bsv2Rk390GTDJOSujYaMxI,11
65
- sentry_sdk-0.18.0.dist-info/RECORD,,