sentry-sdk 2.30.0__tar.gz → 3.0.0a2__tar.gz

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.

Files changed (199) hide show
  1. {sentry_sdk-2.30.0/sentry_sdk.egg-info → sentry_sdk-3.0.0a2}/PKG-INFO +3 -5
  2. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/__init__.py +3 -8
  3. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/_compat.py +0 -1
  4. sentry_sdk-3.0.0a2/sentry_sdk/_init_implementation.py +46 -0
  5. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/_types.py +2 -64
  6. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/ai/monitoring.py +14 -10
  7. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/ai/utils.py +1 -1
  8. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/api.py +56 -169
  9. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/client.py +27 -72
  10. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/consts.py +60 -23
  11. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/debug.py +0 -10
  12. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/envelope.py +1 -3
  13. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/feature_flags.py +1 -1
  14. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/__init__.py +4 -2
  15. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/_asgi_common.py +5 -6
  16. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/_wsgi_common.py +11 -40
  17. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/aiohttp.py +104 -57
  18. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/anthropic.py +10 -7
  19. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/arq.py +24 -13
  20. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/asgi.py +102 -83
  21. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/asyncio.py +1 -0
  22. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/asyncpg.py +45 -30
  23. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/aws_lambda.py +109 -92
  24. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/boto3.py +38 -9
  25. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/bottle.py +1 -1
  26. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/celery/__init__.py +51 -41
  27. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/clickhouse_driver.py +59 -28
  28. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/cohere.py +2 -0
  29. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/django/__init__.py +25 -46
  30. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/django/asgi.py +6 -2
  31. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/django/caching.py +13 -22
  32. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/django/middleware.py +1 -0
  33. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/django/signals_handlers.py +3 -1
  34. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/django/templates.py +8 -12
  35. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/django/transactions.py +1 -6
  36. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/django/views.py +5 -2
  37. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/falcon.py +7 -25
  38. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/fastapi.py +3 -3
  39. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/flask.py +1 -1
  40. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/gcp.py +63 -38
  41. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/graphene.py +6 -13
  42. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/grpc/aio/client.py +14 -8
  43. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/grpc/aio/server.py +19 -21
  44. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/grpc/client.py +8 -6
  45. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/grpc/server.py +12 -14
  46. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/httpx.py +47 -12
  47. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/huey.py +26 -22
  48. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/huggingface_hub.py +1 -0
  49. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/langchain.py +22 -15
  50. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/litestar.py +4 -2
  51. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/logging.py +7 -2
  52. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/openai.py +2 -0
  53. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/pymongo.py +18 -25
  54. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/pyramid.py +1 -1
  55. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/quart.py +3 -3
  56. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/ray.py +23 -17
  57. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/_async_common.py +29 -18
  58. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/_sync_common.py +28 -19
  59. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/modules/caches.py +13 -10
  60. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/modules/queries.py +14 -11
  61. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/rb.py +4 -4
  62. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/redis.py +6 -6
  63. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/redis_cluster.py +18 -18
  64. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/redis_py_cluster_legacy.py +4 -4
  65. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/utils.py +64 -24
  66. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/rq.py +68 -23
  67. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/rust_tracing.py +28 -43
  68. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/sanic.py +23 -13
  69. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/socket.py +9 -5
  70. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/sqlalchemy.py +8 -8
  71. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/starlette.py +11 -31
  72. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/starlite.py +4 -2
  73. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/stdlib.py +56 -9
  74. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/strawberry.py +40 -59
  75. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/threading.py +10 -26
  76. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/tornado.py +57 -18
  77. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/trytond.py +4 -1
  78. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/wsgi.py +84 -38
  79. sentry_sdk-3.0.0a2/sentry_sdk/opentelemetry/__init__.py +9 -0
  80. sentry_sdk-3.0.0a2/sentry_sdk/opentelemetry/consts.py +33 -0
  81. sentry_sdk-3.0.0a2/sentry_sdk/opentelemetry/contextvars_context.py +81 -0
  82. {sentry_sdk-2.30.0/sentry_sdk/integrations → sentry_sdk-3.0.0a2/sentry_sdk}/opentelemetry/propagator.py +19 -28
  83. sentry_sdk-3.0.0a2/sentry_sdk/opentelemetry/sampler.py +326 -0
  84. sentry_sdk-3.0.0a2/sentry_sdk/opentelemetry/scope.py +218 -0
  85. sentry_sdk-3.0.0a2/sentry_sdk/opentelemetry/span_processor.py +335 -0
  86. sentry_sdk-3.0.0a2/sentry_sdk/opentelemetry/tracing.py +59 -0
  87. sentry_sdk-3.0.0a2/sentry_sdk/opentelemetry/utils.py +484 -0
  88. sentry_sdk-3.0.0a2/sentry_sdk/profiler/__init__.py +9 -0
  89. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/profiler/continuous_profiler.py +1 -30
  90. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/profiler/transaction_profiler.py +5 -56
  91. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/scope.py +108 -361
  92. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/sessions.py +0 -87
  93. sentry_sdk-3.0.0a2/sentry_sdk/tracing.py +642 -0
  94. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/tracing_utils.py +130 -166
  95. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/transport.py +4 -104
  96. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/utils.py +169 -152
  97. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2/sentry_sdk.egg-info}/PKG-INFO +3 -5
  98. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk.egg-info/SOURCES.txt +10 -8
  99. sentry_sdk-3.0.0a2/sentry_sdk.egg-info/entry_points.txt +2 -0
  100. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk.egg-info/requires.txt +1 -3
  101. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/setup.py +5 -6
  102. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_ai_monitoring.py +4 -4
  103. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_api.py +28 -85
  104. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_basics.py +54 -234
  105. sentry_sdk-3.0.0a2/tests/test_breadcrumbs.py +86 -0
  106. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_client.py +1 -64
  107. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_dsc.py +231 -24
  108. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_exceptiongroup.py +249 -2
  109. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_feature_flags.py +16 -0
  110. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_logs.py +6 -6
  111. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_monitor.py +27 -8
  112. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_propagationcontext.py +13 -10
  113. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_scope.py +38 -12
  114. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_scrubber.py +9 -5
  115. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_sessions.py +4 -105
  116. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_transport.py +3 -141
  117. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_utils.py +32 -14
  118. sentry_sdk-2.30.0/sentry_sdk/_init_implementation.py +0 -84
  119. sentry_sdk-2.30.0/sentry_sdk/hub.py +0 -739
  120. sentry_sdk-2.30.0/sentry_sdk/integrations/opentelemetry/__init__.py +0 -7
  121. sentry_sdk-2.30.0/sentry_sdk/integrations/opentelemetry/consts.py +0 -5
  122. sentry_sdk-2.30.0/sentry_sdk/integrations/opentelemetry/integration.py +0 -58
  123. sentry_sdk-2.30.0/sentry_sdk/integrations/opentelemetry/span_processor.py +0 -391
  124. sentry_sdk-2.30.0/sentry_sdk/metrics.py +0 -965
  125. sentry_sdk-2.30.0/sentry_sdk/profiler/__init__.py +0 -49
  126. sentry_sdk-2.30.0/sentry_sdk/tracing.py +0 -1388
  127. sentry_sdk-2.30.0/sentry_sdk.egg-info/entry_points.txt +0 -2
  128. sentry_sdk-2.30.0/tests/test_metrics.py +0 -971
  129. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/LICENSE +0 -0
  130. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/MANIFEST.in +0 -0
  131. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/README.md +0 -0
  132. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/pyproject.toml +0 -0
  133. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/_log_batcher.py +0 -0
  134. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/_lru_cache.py +0 -0
  135. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/_queue.py +0 -0
  136. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/_werkzeug.py +0 -0
  137. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/ai/__init__.py +0 -0
  138. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/attachments.py +0 -0
  139. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/crons/__init__.py +0 -0
  140. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/crons/api.py +0 -0
  141. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/crons/consts.py +0 -0
  142. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/crons/decorator.py +0 -0
  143. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/argv.py +0 -0
  144. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/ariadne.py +0 -0
  145. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/atexit.py +0 -0
  146. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/beam.py +0 -0
  147. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/celery/beat.py +0 -0
  148. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/celery/utils.py +0 -0
  149. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/chalice.py +0 -0
  150. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/cloud_resource_context.py +0 -0
  151. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/dedupe.py +0 -0
  152. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/dramatiq.py +0 -0
  153. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/excepthook.py +0 -0
  154. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/executing.py +0 -0
  155. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/gnu_backtrace.py +0 -0
  156. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/gql.py +0 -0
  157. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/grpc/__init__.py +0 -0
  158. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/grpc/aio/__init__.py +0 -0
  159. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/grpc/consts.py +0 -0
  160. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/launchdarkly.py +0 -0
  161. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/loguru.py +0 -0
  162. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/modules.py +0 -0
  163. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/openfeature.py +0 -0
  164. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/pure_eval.py +0 -0
  165. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/__init__.py +0 -0
  166. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/consts.py +0 -0
  167. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/redis/modules/__init__.py +0 -0
  168. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/serverless.py +0 -0
  169. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/spark/__init__.py +0 -0
  170. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/spark/spark_driver.py +0 -0
  171. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/spark/spark_worker.py +0 -0
  172. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/statsig.py +0 -0
  173. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/sys_exit.py +0 -0
  174. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/typer.py +0 -0
  175. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/integrations/unleash.py +0 -0
  176. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/logger.py +0 -0
  177. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/monitor.py +0 -0
  178. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/profiler/utils.py +0 -0
  179. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/py.typed +0 -0
  180. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/scrubber.py +0 -0
  181. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/serializer.py +0 -0
  182. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/session.py +0 -0
  183. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/spotlight.py +0 -0
  184. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/types.py +0 -0
  185. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk/worker.py +0 -0
  186. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk.egg-info/dependency_links.txt +0 -0
  187. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk.egg-info/not-zip-safe +0 -0
  188. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/sentry_sdk.egg-info/top_level.txt +0 -0
  189. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/setup.cfg +0 -0
  190. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_conftest.py +0 -0
  191. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_crons.py +0 -0
  192. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_envelope.py +0 -0
  193. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_full_stack_frames.py +0 -0
  194. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_import.py +0 -0
  195. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_lru_cache.py +0 -0
  196. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_serializer.py +0 -0
  197. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_spotlight.py +0 -0
  198. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_tracing_utils.py +0 -0
  199. {sentry_sdk-2.30.0 → sentry_sdk-3.0.0a2}/tests/test_types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sentry-sdk
3
- Version: 2.30.0
3
+ Version: 3.0.0a2
4
4
  Summary: Python client for Sentry (https://sentry.io)
5
5
  Home-page: https://github.com/getsentry/sentry-python
6
6
  Author: Sentry Team and Contributors
@@ -15,7 +15,6 @@ Classifier: License :: OSI Approved :: BSD License
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Programming Language :: Python
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.6
19
18
  Classifier: Programming Language :: Python :: 3.7
20
19
  Classifier: Programming Language :: Python :: 3.8
21
20
  Classifier: Programming Language :: Python :: 3.9
@@ -24,11 +23,12 @@ Classifier: Programming Language :: Python :: 3.11
24
23
  Classifier: Programming Language :: Python :: 3.12
25
24
  Classifier: Programming Language :: Python :: 3.13
26
25
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
- Requires-Python: >=3.6
26
+ Requires-Python: >=3.7
28
27
  Description-Content-Type: text/markdown
29
28
  License-File: LICENSE
30
29
  Requires-Dist: urllib3>=1.26.11
31
30
  Requires-Dist: certifi
31
+ Requires-Dist: opentelemetry-sdk>=1.4.0
32
32
  Provides-Extra: aiohttp
33
33
  Requires-Dist: aiohttp>=3.5; extra == "aiohttp"
34
34
  Provides-Extra: anthropic
@@ -85,8 +85,6 @@ Provides-Extra: openfeature
85
85
  Requires-Dist: openfeature-sdk>=0.7.1; extra == "openfeature"
86
86
  Provides-Extra: opentelemetry
87
87
  Requires-Dist: opentelemetry-distro>=0.35b0; extra == "opentelemetry"
88
- Provides-Extra: opentelemetry-experimental
89
- Requires-Dist: opentelemetry-distro; extra == "opentelemetry-experimental"
90
88
  Provides-Extra: pure-eval
91
89
  Requires-Dist: pure_eval; extra == "pure-eval"
92
90
  Requires-Dist: executing; extra == "pure-eval"
@@ -1,4 +1,6 @@
1
- from sentry_sdk.scope import Scope
1
+ # TODO-neel scope switch
2
+ # TODO-neel avoid duplication between api and __init__
3
+ from sentry_sdk.opentelemetry.scope import PotelScope as Scope
2
4
  from sentry_sdk.transport import Transport, HttpTransport
3
5
  from sentry_sdk.client import Client
4
6
 
@@ -7,7 +9,6 @@ from sentry_sdk.api import * # noqa
7
9
  from sentry_sdk.consts import VERSION # noqa
8
10
 
9
11
  __all__ = [ # noqa
10
- "Hub",
11
12
  "Scope",
12
13
  "Client",
13
14
  "Transport",
@@ -20,7 +21,6 @@ __all__ = [ # noqa
20
21
  "capture_event",
21
22
  "capture_exception",
22
23
  "capture_message",
23
- "configure_scope",
24
24
  "continue_trace",
25
25
  "flush",
26
26
  "get_baggage",
@@ -34,11 +34,9 @@ __all__ = [ # noqa
34
34
  "isolation_scope",
35
35
  "last_event_id",
36
36
  "new_scope",
37
- "push_scope",
38
37
  "set_context",
39
38
  "set_extra",
40
39
  "set_level",
41
- "set_measurement",
42
40
  "set_tag",
43
41
  "set_tags",
44
42
  "set_user",
@@ -54,6 +52,3 @@ from sentry_sdk.debug import init_debug_support
54
52
 
55
53
  init_debug_support()
56
54
  del init_debug_support
57
-
58
- # circular imports
59
- from sentry_sdk.hub import Hub
@@ -9,7 +9,6 @@ if TYPE_CHECKING:
9
9
  T = TypeVar("T")
10
10
 
11
11
 
12
- PY37 = sys.version_info[0] == 3 and sys.version_info[1] >= 7
13
12
  PY38 = sys.version_info[0] == 3 and sys.version_info[1] >= 8
14
13
  PY310 = sys.version_info[0] == 3 and sys.version_info[1] >= 10
15
14
  PY311 = sys.version_info[0] == 3 and sys.version_info[1] >= 11
@@ -0,0 +1,46 @@
1
+ from typing import TYPE_CHECKING
2
+
3
+ import sentry_sdk
4
+ from sentry_sdk.consts import ClientConstructor
5
+ from sentry_sdk.opentelemetry.scope import setup_scope_context_management
6
+
7
+ if TYPE_CHECKING:
8
+ from typing import Any, Optional
9
+
10
+
11
+ def _check_python_deprecations():
12
+ # type: () -> None
13
+ # Since we're likely to deprecate Python versions in the future, I'm keeping
14
+ # this handy function around. Use this to detect the Python version used and
15
+ # to output logger.warning()s if it's deprecated.
16
+ pass
17
+
18
+
19
+ def _init(*args, **kwargs):
20
+ # type: (*Optional[str], **Any) -> None
21
+ """Initializes the SDK and optionally integrations.
22
+
23
+ This takes the same arguments as the client constructor.
24
+ """
25
+ setup_scope_context_management()
26
+ client = sentry_sdk.Client(*args, **kwargs)
27
+ sentry_sdk.get_global_scope().set_client(client)
28
+ _check_python_deprecations()
29
+
30
+
31
+ if TYPE_CHECKING:
32
+ # Make mypy, PyCharm and other static analyzers think `init` is a type to
33
+ # have nicer autocompletion for params.
34
+ #
35
+ # Use `ClientConstructor` to define the argument types of `init` and
36
+ # `ContextManager[Any]` to tell static analyzers about the return type.
37
+
38
+ class init(ClientConstructor): # noqa: N801
39
+ pass
40
+
41
+ else:
42
+ # Alias `init` for actual usage. Go through the lambda indirection to throw
43
+ # PyCharm off of the weakly typed signature (it would otherwise discover
44
+ # both the weakly typed signature of `_init` and our faked `init` type).
45
+
46
+ init = (lambda: _init)()
@@ -107,9 +107,7 @@ if TYPE_CHECKING:
107
107
  from typing import Callable
108
108
  from typing import Dict
109
109
  from typing import Mapping
110
- from typing import NotRequired
111
110
  from typing import Optional
112
- from typing import Tuple
113
111
  from typing import Type
114
112
  from typing_extensions import Literal, TypedDict
115
113
 
@@ -121,45 +119,6 @@ if TYPE_CHECKING:
121
119
  # "critical" is an alias of "fatal" recognized by Relay
122
120
  LogLevelStr = Literal["fatal", "critical", "error", "warning", "info", "debug"]
123
121
 
124
- DurationUnit = Literal[
125
- "nanosecond",
126
- "microsecond",
127
- "millisecond",
128
- "second",
129
- "minute",
130
- "hour",
131
- "day",
132
- "week",
133
- ]
134
-
135
- InformationUnit = Literal[
136
- "bit",
137
- "byte",
138
- "kilobyte",
139
- "kibibyte",
140
- "megabyte",
141
- "mebibyte",
142
- "gigabyte",
143
- "gibibyte",
144
- "terabyte",
145
- "tebibyte",
146
- "petabyte",
147
- "pebibyte",
148
- "exabyte",
149
- "exbibyte",
150
- ]
151
-
152
- FractionUnit = Literal["ratio", "percent"]
153
- MeasurementUnit = Union[DurationUnit, InformationUnit, FractionUnit, str]
154
-
155
- MeasurementValue = TypedDict(
156
- "MeasurementValue",
157
- {
158
- "value": float,
159
- "unit": NotRequired[Optional[MeasurementUnit]],
160
- },
161
- )
162
-
163
122
  Event = TypedDict(
164
123
  "Event",
165
124
  {
@@ -181,7 +140,6 @@ if TYPE_CHECKING:
181
140
  "level": LogLevelStr,
182
141
  "logentry": Mapping[str, object],
183
142
  "logger": str,
184
- "measurements": dict[str, MeasurementValue],
185
143
  "message": str,
186
144
  "modules": dict[str, str],
187
145
  "monitor_config": Mapping[str, object],
@@ -210,7 +168,6 @@ if TYPE_CHECKING:
210
168
  "type": Literal["check_in", "transaction"],
211
169
  "user": dict[str, object],
212
170
  "_dropped_spans": int,
213
- "_metrics_summary": dict[str, object],
214
171
  },
215
172
  total=False,
216
173
  )
@@ -266,7 +223,6 @@ if TYPE_CHECKING:
266
223
  "internal",
267
224
  "profile",
268
225
  "profile_chunk",
269
- "metric_bucket",
270
226
  "monitor",
271
227
  "span",
272
228
  "log",
@@ -276,26 +232,6 @@ if TYPE_CHECKING:
276
232
  ContinuousProfilerMode = Literal["thread", "gevent", "unknown"]
277
233
  ProfilerMode = Union[ContinuousProfilerMode, Literal["sleep"]]
278
234
 
279
- # Type of the metric.
280
- MetricType = Literal["d", "s", "g", "c"]
281
-
282
- # Value of the metric.
283
- MetricValue = Union[int, float, str]
284
-
285
- # Internal representation of tags as a tuple of tuples (this is done in order to allow for the same key to exist
286
- # multiple times).
287
- MetricTagsInternal = Tuple[Tuple[str, str], ...]
288
-
289
- # External representation of tags as a dictionary.
290
- MetricTagValue = Union[str, int, float, None]
291
- MetricTags = Mapping[str, MetricTagValue]
292
-
293
- # Value inside the generator for the metric value.
294
- FlushedMetricValue = Union[int, float]
295
-
296
- BucketKey = Tuple[MetricType, str, MeasurementUnit, MetricTagsInternal]
297
- MetricMetaKey = Tuple[MetricType, str, MeasurementUnit]
298
-
299
235
  MonitorConfigScheduleType = Literal["crontab", "interval"]
300
236
  MonitorConfigScheduleUnit = Literal[
301
237
  "year",
@@ -331,3 +267,5 @@ if TYPE_CHECKING:
331
267
  )
332
268
 
333
269
  HttpStatusCodeRange = Union[int, Container[int]]
270
+
271
+ OtelExtractedSpanData = tuple[str, str, Optional[str], Optional[int], Optional[str]]
@@ -34,13 +34,15 @@ def ai_track(description, **span_kwargs):
34
34
  curr_pipeline = _ai_pipeline_name.get()
35
35
  op = span_kwargs.get("op", "ai.run" if curr_pipeline else "ai.pipeline")
36
36
 
37
- with start_span(name=description, op=op, **span_kwargs) as span:
37
+ with start_span(
38
+ name=description, op=op, only_if_parent=True, **span_kwargs
39
+ ) as span:
38
40
  for k, v in kwargs.pop("sentry_tags", {}).items():
39
41
  span.set_tag(k, v)
40
42
  for k, v in kwargs.pop("sentry_data", {}).items():
41
- span.set_data(k, v)
43
+ span.set_attribute(k, v)
42
44
  if curr_pipeline:
43
- span.set_data(SPANDATA.AI_PIPELINE_NAME, curr_pipeline)
45
+ span.set_attribute(SPANDATA.AI_PIPELINE_NAME, curr_pipeline)
44
46
  return f(*args, **kwargs)
45
47
  else:
46
48
  _ai_pipeline_name.set(description)
@@ -63,13 +65,15 @@ def ai_track(description, **span_kwargs):
63
65
  curr_pipeline = _ai_pipeline_name.get()
64
66
  op = span_kwargs.get("op", "ai.run" if curr_pipeline else "ai.pipeline")
65
67
 
66
- with start_span(name=description, op=op, **span_kwargs) as span:
68
+ with start_span(
69
+ name=description, op=op, only_if_parent=True, **span_kwargs
70
+ ) as span:
67
71
  for k, v in kwargs.pop("sentry_tags", {}).items():
68
72
  span.set_tag(k, v)
69
73
  for k, v in kwargs.pop("sentry_data", {}).items():
70
- span.set_data(k, v)
74
+ span.set_attribute(k, v)
71
75
  if curr_pipeline:
72
- span.set_data(SPANDATA.AI_PIPELINE_NAME, curr_pipeline)
76
+ span.set_attribute(SPANDATA.AI_PIPELINE_NAME, curr_pipeline)
73
77
  return await f(*args, **kwargs)
74
78
  else:
75
79
  _ai_pipeline_name.set(description)
@@ -101,11 +105,11 @@ def record_token_usage(
101
105
  # type: (Span, Optional[int], Optional[int], Optional[int]) -> None
102
106
  ai_pipeline_name = get_ai_pipeline_name()
103
107
  if ai_pipeline_name:
104
- span.set_data(SPANDATA.AI_PIPELINE_NAME, ai_pipeline_name)
108
+ span.set_attribute(SPANDATA.AI_PIPELINE_NAME, ai_pipeline_name)
105
109
  if prompt_tokens is not None:
106
- span.set_measurement("ai_prompt_tokens_used", value=prompt_tokens)
110
+ span.set_attribute(SPANDATA.AI_PROMPT_TOKENS_USED, prompt_tokens)
107
111
  if completion_tokens is not None:
108
- span.set_measurement("ai_completion_tokens_used", value=completion_tokens)
112
+ span.set_attribute(SPANDATA.AI_COMPLETION_TOKENS_USED, completion_tokens)
109
113
  if (
110
114
  total_tokens is None
111
115
  and prompt_tokens is not None
@@ -113,4 +117,4 @@ def record_token_usage(
113
117
  ):
114
118
  total_tokens = prompt_tokens + completion_tokens
115
119
  if total_tokens is not None:
116
- span.set_measurement("ai_total_tokens_used", total_tokens)
120
+ span.set_attribute(SPANDATA.AI_TOTAL_TOKENS_USED, total_tokens)
@@ -29,4 +29,4 @@ def _normalize_data(data):
29
29
  def set_data_normalized(span, key, value):
30
30
  # type: (Span, str, Any) -> None
31
31
  normalized = _normalize_data(value)
32
- span.set_data(key, normalized)
32
+ span.set_attribute(key, normalized)
@@ -1,14 +1,22 @@
1
1
  import inspect
2
- import warnings
3
2
  from contextlib import contextmanager
4
3
 
5
4
  from sentry_sdk import tracing_utils, Client
6
5
  from sentry_sdk._init_implementation import init
7
- from sentry_sdk.consts import INSTRUMENTER
8
- from sentry_sdk.scope import Scope, _ScopeManager, new_scope, isolation_scope
9
- from sentry_sdk.tracing import NoOpSpan, Transaction, trace
6
+ from sentry_sdk.tracing import trace
10
7
  from sentry_sdk.crons import monitor
11
8
 
9
+ # TODO-neel-potel make 2 scope strategies/impls and switch
10
+ from sentry_sdk.scope import Scope as BaseScope
11
+ from sentry_sdk.opentelemetry.scope import (
12
+ PotelScope as Scope,
13
+ new_scope,
14
+ isolation_scope,
15
+ use_scope,
16
+ use_isolation_scope,
17
+ )
18
+
19
+
12
20
  from typing import TYPE_CHECKING
13
21
 
14
22
  if TYPE_CHECKING:
@@ -16,36 +24,16 @@ if TYPE_CHECKING:
16
24
 
17
25
  from typing import Any
18
26
  from typing import Dict
19
- from typing import Generator
20
27
  from typing import Optional
21
- from typing import overload
22
28
  from typing import Callable
23
29
  from typing import TypeVar
24
- from typing import ContextManager
25
30
  from typing import Union
31
+ from typing import Generator
26
32
 
27
- from typing_extensions import Unpack
28
-
29
- from sentry_sdk.client import BaseClient
30
- from sentry_sdk._types import (
31
- Event,
32
- Hint,
33
- Breadcrumb,
34
- BreadcrumbHint,
35
- ExcInfo,
36
- MeasurementUnit,
37
- LogLevelStr,
38
- SamplingContext,
39
- )
40
- from sentry_sdk.tracing import Span, TransactionKwargs
33
+ import sentry_sdk
41
34
 
42
35
  T = TypeVar("T")
43
36
  F = TypeVar("F", bound=Callable[..., Any])
44
- else:
45
-
46
- def overload(x):
47
- # type: (T) -> T
48
- return x
49
37
 
50
38
 
51
39
  # When changing this, update __all__ in __init__.py too
@@ -56,7 +44,6 @@ __all__ = [
56
44
  "capture_event",
57
45
  "capture_exception",
58
46
  "capture_message",
59
- "configure_scope",
60
47
  "continue_trace",
61
48
  "flush",
62
49
  "get_baggage",
@@ -70,11 +57,9 @@ __all__ = [
70
57
  "isolation_scope",
71
58
  "last_event_id",
72
59
  "new_scope",
73
- "push_scope",
74
60
  "set_context",
75
61
  "set_extra",
76
62
  "set_level",
77
- "set_measurement",
78
63
  "set_tag",
79
64
  "set_tags",
80
65
  "set_user",
@@ -82,6 +67,8 @@ __all__ = [
82
67
  "start_transaction",
83
68
  "trace",
84
69
  "monitor",
70
+ "use_scope",
71
+ "use_isolation_scope",
85
72
  ]
86
73
 
87
74
 
@@ -105,7 +92,7 @@ def clientmethod(f):
105
92
 
106
93
  @scopemethod
107
94
  def get_client():
108
- # type: () -> BaseClient
95
+ # type: () -> sentry_sdk.client.BaseClient
109
96
  return Scope.get_client()
110
97
 
111
98
 
@@ -125,7 +112,7 @@ def is_initialized():
125
112
 
126
113
  @scopemethod
127
114
  def get_global_scope():
128
- # type: () -> Scope
115
+ # type: () -> BaseScope
129
116
  return Scope.get_global_scope()
130
117
 
131
118
 
@@ -153,8 +140,8 @@ def last_event_id():
153
140
 
154
141
  @scopemethod
155
142
  def capture_event(
156
- event, # type: Event
157
- hint=None, # type: Optional[Hint]
143
+ event, # type: sentry_sdk._types.Event
144
+ hint=None, # type: Optional[sentry_sdk._types.Hint]
158
145
  scope=None, # type: Optional[Any]
159
146
  **scope_kwargs, # type: Any
160
147
  ):
@@ -165,7 +152,7 @@ def capture_event(
165
152
  @scopemethod
166
153
  def capture_message(
167
154
  message, # type: str
168
- level=None, # type: Optional[LogLevelStr]
155
+ level=None, # type: Optional[sentry_sdk._types.LogLevelStr]
169
156
  scope=None, # type: Optional[Any]
170
157
  **scope_kwargs, # type: Any
171
158
  ):
@@ -177,7 +164,7 @@ def capture_message(
177
164
 
178
165
  @scopemethod
179
166
  def capture_exception(
180
- error=None, # type: Optional[Union[BaseException, ExcInfo]]
167
+ error=None, # type: Optional[Union[BaseException, sentry_sdk._types.ExcInfo]]
181
168
  scope=None, # type: Optional[Any]
182
169
  **scope_kwargs, # type: Any
183
170
  ):
@@ -201,109 +188,14 @@ def add_attachment(
201
188
 
202
189
  @scopemethod
203
190
  def add_breadcrumb(
204
- crumb=None, # type: Optional[Breadcrumb]
205
- hint=None, # type: Optional[BreadcrumbHint]
191
+ crumb=None, # type: Optional[sentry_sdk._types.Breadcrumb]
192
+ hint=None, # type: Optional[sentry_sdk._types.BreadcrumbHint]
206
193
  **kwargs, # type: Any
207
194
  ):
208
195
  # type: (...) -> None
209
196
  return get_isolation_scope().add_breadcrumb(crumb, hint, **kwargs)
210
197
 
211
198
 
212
- @overload
213
- def configure_scope():
214
- # type: () -> ContextManager[Scope]
215
- pass
216
-
217
-
218
- @overload
219
- def configure_scope( # noqa: F811
220
- callback, # type: Callable[[Scope], None]
221
- ):
222
- # type: (...) -> None
223
- pass
224
-
225
-
226
- def configure_scope( # noqa: F811
227
- callback=None, # type: Optional[Callable[[Scope], None]]
228
- ):
229
- # type: (...) -> Optional[ContextManager[Scope]]
230
- """
231
- Reconfigures the scope.
232
-
233
- :param callback: If provided, call the callback with the current scope.
234
-
235
- :returns: If no callback is provided, returns a context manager that returns the scope.
236
- """
237
- warnings.warn(
238
- "sentry_sdk.configure_scope is deprecated and will be removed in the next major version. "
239
- "Please consult our migration guide to learn how to migrate to the new API: "
240
- "https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-configuring",
241
- DeprecationWarning,
242
- stacklevel=2,
243
- )
244
-
245
- scope = get_isolation_scope()
246
- scope.generate_propagation_context()
247
-
248
- if callback is not None:
249
- # TODO: used to return None when client is None. Check if this changes behavior.
250
- callback(scope)
251
-
252
- return None
253
-
254
- @contextmanager
255
- def inner():
256
- # type: () -> Generator[Scope, None, None]
257
- yield scope
258
-
259
- return inner()
260
-
261
-
262
- @overload
263
- def push_scope():
264
- # type: () -> ContextManager[Scope]
265
- pass
266
-
267
-
268
- @overload
269
- def push_scope( # noqa: F811
270
- callback, # type: Callable[[Scope], None]
271
- ):
272
- # type: (...) -> None
273
- pass
274
-
275
-
276
- def push_scope( # noqa: F811
277
- callback=None, # type: Optional[Callable[[Scope], None]]
278
- ):
279
- # type: (...) -> Optional[ContextManager[Scope]]
280
- """
281
- Pushes a new layer on the scope stack.
282
-
283
- :param callback: If provided, this method pushes a scope, calls
284
- `callback`, and pops the scope again.
285
-
286
- :returns: If no `callback` is provided, a context manager that should
287
- be used to pop the scope again.
288
- """
289
- warnings.warn(
290
- "sentry_sdk.push_scope is deprecated and will be removed in the next major version. "
291
- "Please consult our migration guide to learn how to migrate to the new API: "
292
- "https://docs.sentry.io/platforms/python/migration/1.x-to-2.x#scope-pushing",
293
- DeprecationWarning,
294
- stacklevel=2,
295
- )
296
-
297
- if callback is not None:
298
- with warnings.catch_warnings():
299
- warnings.simplefilter("ignore", DeprecationWarning)
300
- with push_scope() as scope:
301
- callback(scope)
302
- return None
303
-
304
- return _ScopeManager()
305
-
306
-
307
199
  @scopemethod
308
200
  def set_tag(key, value):
309
201
  # type: (str, Any) -> None
@@ -336,7 +228,7 @@ def set_user(value):
336
228
 
337
229
  @scopemethod
338
230
  def set_level(value):
339
- # type: (LogLevelStr) -> None
231
+ # type: (sentry_sdk._types.LogLevelStr) -> None
340
232
  return get_isolation_scope().set_level(value)
341
233
 
342
234
 
@@ -349,23 +241,33 @@ def flush(
349
241
  return get_client().flush(timeout=timeout, callback=callback)
350
242
 
351
243
 
352
- @scopemethod
353
- def start_span(
354
- **kwargs, # type: Any
355
- ):
356
- # type: (...) -> Span
244
+ def start_span(**kwargs):
245
+ # type: (Any) -> sentry_sdk.tracing.Span
246
+ """
247
+ Start and return a span.
248
+
249
+ This is the entry point to manual tracing instrumentation.
250
+
251
+ A tree structure can be built by adding child spans to the span.
252
+ To start a new child span within the span, call the `start_child()` method.
253
+
254
+ When used as a context manager, spans are automatically finished at the end
255
+ of the `with` block. If not using context managers, call the `finish()`
256
+ method.
257
+ """
357
258
  return get_current_scope().start_span(**kwargs)
358
259
 
359
260
 
360
- @scopemethod
361
261
  def start_transaction(
362
- transaction=None, # type: Optional[Transaction]
363
- instrumenter=INSTRUMENTER.SENTRY, # type: str
364
- custom_sampling_context=None, # type: Optional[SamplingContext]
365
- **kwargs, # type: Unpack[TransactionKwargs]
262
+ transaction=None, # type: Optional[sentry_sdk.tracing.Span]
263
+ **kwargs, # type: Any
366
264
  ):
367
- # type: (...) -> Union[Transaction, NoOpSpan]
265
+ # type: (...) -> sentry_sdk.tracing.Span
368
266
  """
267
+ .. deprecated:: 3.0.0
268
+ This function is deprecated and will be removed in a future release.
269
+ Use :py:meth:`sentry_sdk.start_span` instead.
270
+
369
271
  Start and return a transaction on the current scope.
370
272
 
371
273
  Start an existing transaction if given, otherwise create and start a new
@@ -389,31 +291,18 @@ def start_transaction(
389
291
 
390
292
  :param transaction: The transaction to start. If omitted, we create and
391
293
  start a new transaction.
392
- :param instrumenter: This parameter is meant for internal use only. It
393
- will be removed in the next major version.
394
- :param custom_sampling_context: The transaction's custom sampling context.
395
294
  :param kwargs: Optional keyword arguments to be passed to the Transaction
396
295
  constructor. See :py:class:`sentry_sdk.tracing.Transaction` for
397
296
  available arguments.
398
297
  """
399
- return get_current_scope().start_transaction(
400
- transaction, instrumenter, custom_sampling_context, **kwargs
298
+ return start_span(
299
+ span=transaction,
300
+ **kwargs,
401
301
  )
402
302
 
403
303
 
404
- def set_measurement(name, value, unit=""):
405
- # type: (str, float, MeasurementUnit) -> None
406
- """
407
- .. deprecated:: 2.28.0
408
- This function is deprecated and will be removed in the next major release.
409
- """
410
- transaction = get_current_scope().transaction
411
- if transaction is not None:
412
- transaction.set_measurement(name, value, unit)
413
-
414
-
415
304
  def get_current_span(scope=None):
416
- # type: (Optional[Scope]) -> Optional[Span]
305
+ # type: (Optional[Scope]) -> Optional[sentry_sdk.tracing.Span]
417
306
  """
418
307
  Returns the currently active span if there is one running, otherwise `None`
419
308
  """
@@ -440,13 +329,11 @@ def get_baggage():
440
329
  return None
441
330
 
442
331
 
443
- def continue_trace(
444
- environ_or_headers, op=None, name=None, source=None, origin="manual"
445
- ):
446
- # type: (Dict[str, Any], Optional[str], Optional[str], Optional[str], str) -> Transaction
332
+ @contextmanager
333
+ def continue_trace(environ_or_headers):
334
+ # type: (Dict[str, Any]) -> Generator[None, None, None]
447
335
  """
448
- Sets the propagation context from environment or headers and returns a transaction.
336
+ Sets the propagation context from environment or headers to continue an incoming trace.
449
337
  """
450
- return get_isolation_scope().continue_trace(
451
- environ_or_headers, op, name, source, origin
452
- )
338
+ with get_isolation_scope().continue_trace(environ_or_headers):
339
+ yield