sentry-sdk 2.32.0__tar.gz → 2.33.1__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 (201) hide show
  1. {sentry_sdk-2.32.0/sentry_sdk.egg-info → sentry_sdk-2.33.1}/PKG-INFO +1 -1
  2. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/ai/monitoring.py +34 -15
  3. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/consts.py +1 -1
  4. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/anthropic.py +13 -2
  5. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/cohere.py +5 -5
  6. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/huggingface_hub.py +8 -2
  7. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/langchain.py +43 -24
  8. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai.py +65 -38
  9. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/spans/ai_client.py +2 -1
  10. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/utils.py +2 -1
  11. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/monitor.py +0 -4
  12. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/sessions.py +8 -13
  13. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/transport.py +0 -7
  14. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/utils.py +6 -1
  15. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1/sentry_sdk.egg-info}/PKG-INFO +1 -1
  16. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk.egg-info/SOURCES.txt +1 -0
  17. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/setup.py +1 -1
  18. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_ai_monitoring.py +41 -0
  19. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_api.py +0 -10
  20. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_client.py +2 -1
  21. sentry_sdk-2.33.1/tests/test_gevent.py +118 -0
  22. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_transport.py +13 -71
  23. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_utils.py +0 -42
  24. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/LICENSE +0 -0
  25. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/MANIFEST.in +0 -0
  26. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/README.md +0 -0
  27. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/pyproject.toml +0 -0
  28. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/__init__.py +0 -0
  29. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/_compat.py +0 -0
  30. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/_init_implementation.py +0 -0
  31. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/_log_batcher.py +0 -0
  32. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/_lru_cache.py +0 -0
  33. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/_queue.py +0 -0
  34. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/_types.py +0 -0
  35. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/_werkzeug.py +0 -0
  36. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/ai/__init__.py +0 -0
  37. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/ai/utils.py +0 -0
  38. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/api.py +0 -0
  39. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/attachments.py +0 -0
  40. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/client.py +0 -0
  41. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/crons/__init__.py +0 -0
  42. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/crons/api.py +0 -0
  43. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/crons/consts.py +0 -0
  44. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/crons/decorator.py +0 -0
  45. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/debug.py +0 -0
  46. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/envelope.py +0 -0
  47. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/feature_flags.py +0 -0
  48. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/hub.py +0 -0
  49. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/__init__.py +0 -0
  50. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/_asgi_common.py +0 -0
  51. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/_wsgi_common.py +0 -0
  52. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/aiohttp.py +0 -0
  53. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/argv.py +0 -0
  54. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/ariadne.py +0 -0
  55. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/arq.py +0 -0
  56. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/asgi.py +0 -0
  57. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/asyncio.py +0 -0
  58. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/asyncpg.py +0 -0
  59. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/atexit.py +0 -0
  60. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/aws_lambda.py +0 -0
  61. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/beam.py +0 -0
  62. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/boto3.py +0 -0
  63. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/bottle.py +0 -0
  64. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/celery/__init__.py +0 -0
  65. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/celery/beat.py +0 -0
  66. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/celery/utils.py +0 -0
  67. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/chalice.py +0 -0
  68. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/clickhouse_driver.py +0 -0
  69. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/cloud_resource_context.py +0 -0
  70. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/dedupe.py +0 -0
  71. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/django/__init__.py +0 -0
  72. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/django/asgi.py +0 -0
  73. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/django/caching.py +0 -0
  74. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/django/middleware.py +0 -0
  75. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/django/signals_handlers.py +0 -0
  76. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/django/templates.py +0 -0
  77. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/django/transactions.py +0 -0
  78. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/django/views.py +0 -0
  79. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/dramatiq.py +0 -0
  80. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/excepthook.py +0 -0
  81. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/executing.py +0 -0
  82. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/falcon.py +0 -0
  83. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/fastapi.py +0 -0
  84. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/flask.py +0 -0
  85. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/gcp.py +0 -0
  86. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/gnu_backtrace.py +0 -0
  87. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/gql.py +0 -0
  88. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/graphene.py +0 -0
  89. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/grpc/__init__.py +0 -0
  90. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/grpc/aio/__init__.py +0 -0
  91. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/grpc/aio/client.py +0 -0
  92. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/grpc/aio/server.py +0 -0
  93. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/grpc/client.py +0 -0
  94. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/grpc/consts.py +0 -0
  95. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/grpc/server.py +0 -0
  96. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/httpx.py +0 -0
  97. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/huey.py +0 -0
  98. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/launchdarkly.py +0 -0
  99. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/litestar.py +0 -0
  100. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/logging.py +0 -0
  101. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/loguru.py +0 -0
  102. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/modules.py +0 -0
  103. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/__init__.py +0 -0
  104. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/consts.py +0 -0
  105. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/patches/__init__.py +0 -0
  106. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/patches/agent_run.py +0 -0
  107. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/patches/models.py +0 -0
  108. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/patches/runner.py +0 -0
  109. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/patches/tools.py +0 -0
  110. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/spans/__init__.py +0 -0
  111. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/spans/agent_workflow.py +0 -0
  112. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/spans/execute_tool.py +0 -0
  113. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/spans/handoff.py +0 -0
  114. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openai_agents/spans/invoke_agent.py +0 -0
  115. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/openfeature.py +0 -0
  116. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/opentelemetry/__init__.py +0 -0
  117. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/opentelemetry/consts.py +0 -0
  118. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/opentelemetry/integration.py +0 -0
  119. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/opentelemetry/propagator.py +0 -0
  120. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/opentelemetry/span_processor.py +0 -0
  121. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/pure_eval.py +0 -0
  122. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/pymongo.py +0 -0
  123. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/pyramid.py +0 -0
  124. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/quart.py +0 -0
  125. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/ray.py +0 -0
  126. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/__init__.py +0 -0
  127. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/_async_common.py +0 -0
  128. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/_sync_common.py +0 -0
  129. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/consts.py +0 -0
  130. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/modules/__init__.py +0 -0
  131. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/modules/caches.py +0 -0
  132. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/modules/queries.py +0 -0
  133. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/rb.py +0 -0
  134. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/redis.py +0 -0
  135. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/redis_cluster.py +0 -0
  136. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/redis_py_cluster_legacy.py +0 -0
  137. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/redis/utils.py +0 -0
  138. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/rq.py +0 -0
  139. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/rust_tracing.py +0 -0
  140. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/sanic.py +0 -0
  141. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/serverless.py +0 -0
  142. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/socket.py +0 -0
  143. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/spark/__init__.py +0 -0
  144. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/spark/spark_driver.py +0 -0
  145. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/spark/spark_worker.py +0 -0
  146. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/sqlalchemy.py +0 -0
  147. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/starlette.py +0 -0
  148. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/starlite.py +0 -0
  149. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/statsig.py +0 -0
  150. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/stdlib.py +0 -0
  151. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/strawberry.py +0 -0
  152. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/sys_exit.py +0 -0
  153. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/threading.py +0 -0
  154. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/tornado.py +0 -0
  155. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/trytond.py +0 -0
  156. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/typer.py +0 -0
  157. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/unleash.py +0 -0
  158. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/integrations/wsgi.py +0 -0
  159. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/logger.py +0 -0
  160. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/metrics.py +0 -0
  161. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/profiler/__init__.py +0 -0
  162. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/profiler/continuous_profiler.py +0 -0
  163. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/profiler/transaction_profiler.py +0 -0
  164. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/profiler/utils.py +0 -0
  165. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/py.typed +0 -0
  166. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/scope.py +0 -0
  167. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/scrubber.py +0 -0
  168. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/serializer.py +0 -0
  169. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/session.py +0 -0
  170. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/spotlight.py +0 -0
  171. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/tracing.py +0 -0
  172. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/tracing_utils.py +0 -0
  173. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/types.py +0 -0
  174. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk/worker.py +0 -0
  175. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk.egg-info/dependency_links.txt +0 -0
  176. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk.egg-info/entry_points.txt +0 -0
  177. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk.egg-info/not-zip-safe +0 -0
  178. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk.egg-info/requires.txt +0 -0
  179. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/sentry_sdk.egg-info/top_level.txt +0 -0
  180. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/setup.cfg +0 -0
  181. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_basics.py +0 -0
  182. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_conftest.py +0 -0
  183. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_crons.py +0 -0
  184. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_dsc.py +0 -0
  185. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_envelope.py +0 -0
  186. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_exceptiongroup.py +0 -0
  187. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_feature_flags.py +0 -0
  188. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_full_stack_frames.py +0 -0
  189. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_import.py +0 -0
  190. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_logs.py +0 -0
  191. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_lru_cache.py +0 -0
  192. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_metrics.py +0 -0
  193. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_monitor.py +0 -0
  194. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_propagationcontext.py +0 -0
  195. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_scope.py +0 -0
  196. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_scrubber.py +0 -0
  197. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_serializer.py +0 -0
  198. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_sessions.py +0 -0
  199. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_spotlight.py +0 -0
  200. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_tracing_utils.py +0 -0
  201. {sentry_sdk-2.32.0 → sentry_sdk-2.33.1}/tests/test_types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sentry-sdk
3
- Version: 2.32.0
3
+ Version: 2.33.1
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
@@ -32,7 +32,7 @@ def ai_track(description, **span_kwargs):
32
32
  def sync_wrapped(*args, **kwargs):
33
33
  # type: (Any, Any) -> Any
34
34
  curr_pipeline = _ai_pipeline_name.get()
35
- op = span_kwargs.get("op", "ai.run" if curr_pipeline else "ai.pipeline")
35
+ op = span_kwargs.pop("op", "ai.run" if curr_pipeline else "ai.pipeline")
36
36
 
37
37
  with start_span(name=description, op=op, **span_kwargs) as span:
38
38
  for k, v in kwargs.pop("sentry_tags", {}).items():
@@ -61,7 +61,7 @@ def ai_track(description, **span_kwargs):
61
61
  async def async_wrapped(*args, **kwargs):
62
62
  # type: (Any, Any) -> Any
63
63
  curr_pipeline = _ai_pipeline_name.get()
64
- op = span_kwargs.get("op", "ai.run" if curr_pipeline else "ai.pipeline")
64
+ op = span_kwargs.pop("op", "ai.run" if curr_pipeline else "ai.pipeline")
65
65
 
66
66
  with start_span(name=description, op=op, **span_kwargs) as span:
67
67
  for k, v in kwargs.pop("sentry_tags", {}).items():
@@ -96,21 +96,40 @@ def ai_track(description, **span_kwargs):
96
96
 
97
97
 
98
98
  def record_token_usage(
99
- span, prompt_tokens=None, completion_tokens=None, total_tokens=None
99
+ span,
100
+ input_tokens=None,
101
+ input_tokens_cached=None,
102
+ output_tokens=None,
103
+ output_tokens_reasoning=None,
104
+ total_tokens=None,
100
105
  ):
101
- # type: (Span, Optional[int], Optional[int], Optional[int]) -> None
106
+ # type: (Span, Optional[int], Optional[int], Optional[int], Optional[int], Optional[int]) -> None
107
+
108
+ # TODO: move pipeline name elsewhere
102
109
  ai_pipeline_name = get_ai_pipeline_name()
103
110
  if ai_pipeline_name:
104
111
  span.set_data(SPANDATA.AI_PIPELINE_NAME, ai_pipeline_name)
105
- if prompt_tokens is not None:
106
- span.set_measurement("ai_prompt_tokens_used", value=prompt_tokens)
107
- if completion_tokens is not None:
108
- span.set_measurement("ai_completion_tokens_used", value=completion_tokens)
109
- if (
110
- total_tokens is None
111
- and prompt_tokens is not None
112
- and completion_tokens is not None
113
- ):
114
- total_tokens = prompt_tokens + completion_tokens
112
+
113
+ if input_tokens is not None:
114
+ span.set_data(SPANDATA.GEN_AI_USAGE_INPUT_TOKENS, input_tokens)
115
+
116
+ if input_tokens_cached is not None:
117
+ span.set_data(
118
+ SPANDATA.GEN_AI_USAGE_INPUT_TOKENS_CACHED,
119
+ input_tokens_cached,
120
+ )
121
+
122
+ if output_tokens is not None:
123
+ span.set_data(SPANDATA.GEN_AI_USAGE_OUTPUT_TOKENS, output_tokens)
124
+
125
+ if output_tokens_reasoning is not None:
126
+ span.set_data(
127
+ SPANDATA.GEN_AI_USAGE_OUTPUT_TOKENS_REASONING,
128
+ output_tokens_reasoning,
129
+ )
130
+
131
+ if total_tokens is None and input_tokens is not None and output_tokens is not None:
132
+ total_tokens = input_tokens + output_tokens
133
+
115
134
  if total_tokens is not None:
116
- span.set_measurement("ai_total_tokens_used", total_tokens)
135
+ span.set_data(SPANDATA.GEN_AI_USAGE_TOTAL_TOKENS, total_tokens)
@@ -1181,4 +1181,4 @@ DEFAULT_OPTIONS = _get_default_options()
1181
1181
  del _get_default_options
1182
1182
 
1183
1183
 
1184
- VERSION = "2.32.0"
1184
+ VERSION = "2.33.1"
@@ -65,7 +65,13 @@ def _calculate_token_usage(result, span):
65
65
  output_tokens = usage.output_tokens
66
66
 
67
67
  total_tokens = input_tokens + output_tokens
68
- record_token_usage(span, input_tokens, output_tokens, total_tokens)
68
+
69
+ record_token_usage(
70
+ span,
71
+ input_tokens=input_tokens,
72
+ output_tokens=output_tokens,
73
+ total_tokens=total_tokens,
74
+ )
69
75
 
70
76
 
71
77
  def _get_responses(content):
@@ -126,7 +132,12 @@ def _add_ai_data_to_span(
126
132
  [{"type": "text", "text": complete_message}],
127
133
  )
128
134
  total_tokens = input_tokens + output_tokens
129
- record_token_usage(span, input_tokens, output_tokens, total_tokens)
135
+ record_token_usage(
136
+ span,
137
+ input_tokens=input_tokens,
138
+ output_tokens=output_tokens,
139
+ total_tokens=total_tokens,
140
+ )
130
141
  span.set_data(SPANDATA.AI_STREAMING, True)
131
142
 
132
143
 
@@ -116,14 +116,14 @@ def _wrap_chat(f, streaming):
116
116
  if hasattr(res.meta, "billed_units"):
117
117
  record_token_usage(
118
118
  span,
119
- prompt_tokens=res.meta.billed_units.input_tokens,
120
- completion_tokens=res.meta.billed_units.output_tokens,
119
+ input_tokens=res.meta.billed_units.input_tokens,
120
+ output_tokens=res.meta.billed_units.output_tokens,
121
121
  )
122
122
  elif hasattr(res.meta, "tokens"):
123
123
  record_token_usage(
124
124
  span,
125
- prompt_tokens=res.meta.tokens.input_tokens,
126
- completion_tokens=res.meta.tokens.output_tokens,
125
+ input_tokens=res.meta.tokens.input_tokens,
126
+ output_tokens=res.meta.tokens.output_tokens,
127
127
  )
128
128
 
129
129
  if hasattr(res.meta, "warnings"):
@@ -262,7 +262,7 @@ def _wrap_embed(f):
262
262
  ):
263
263
  record_token_usage(
264
264
  span,
265
- prompt_tokens=res.meta.billed_units.input_tokens,
265
+ input_tokens=res.meta.billed_units.input_tokens,
266
266
  total_tokens=res.meta.billed_units.input_tokens,
267
267
  )
268
268
  return res
@@ -111,7 +111,10 @@ def _wrap_text_generation(f):
111
111
  [res.generated_text],
112
112
  )
113
113
  if res.details is not None and res.details.generated_tokens > 0:
114
- record_token_usage(span, total_tokens=res.details.generated_tokens)
114
+ record_token_usage(
115
+ span,
116
+ total_tokens=res.details.generated_tokens,
117
+ )
115
118
  span.__exit__(None, None, None)
116
119
  return res
117
120
 
@@ -145,7 +148,10 @@ def _wrap_text_generation(f):
145
148
  span, SPANDATA.AI_RESPONSES, "".join(data_buf)
146
149
  )
147
150
  if tokens_used > 0:
148
- record_token_usage(span, total_tokens=tokens_used)
151
+ record_token_usage(
152
+ span,
153
+ total_tokens=tokens_used,
154
+ )
149
155
  span.__exit__(None, None, None)
150
156
 
151
157
  return new_details_iterator()
@@ -23,6 +23,7 @@ try:
23
23
  from langchain_core.callbacks import (
24
24
  manager,
25
25
  BaseCallbackHandler,
26
+ BaseCallbackManager,
26
27
  Callbacks,
27
28
  )
28
29
  from langchain_core.agents import AgentAction, AgentFinish
@@ -278,15 +279,15 @@ class SentryLangchainCallback(BaseCallbackHandler): # type: ignore[misc]
278
279
  if token_usage:
279
280
  record_token_usage(
280
281
  span_data.span,
281
- token_usage.get("prompt_tokens"),
282
- token_usage.get("completion_tokens"),
283
- token_usage.get("total_tokens"),
282
+ input_tokens=token_usage.get("prompt_tokens"),
283
+ output_tokens=token_usage.get("completion_tokens"),
284
+ total_tokens=token_usage.get("total_tokens"),
284
285
  )
285
286
  else:
286
287
  record_token_usage(
287
288
  span_data.span,
288
- span_data.num_prompt_tokens,
289
- span_data.num_completion_tokens,
289
+ input_tokens=span_data.num_prompt_tokens,
290
+ output_tokens=span_data.num_completion_tokens,
290
291
  )
291
292
 
292
293
  self._exit_span(span_data, run_id)
@@ -434,12 +435,20 @@ def _wrap_configure(f):
434
435
  **kwargs,
435
436
  )
436
437
 
437
- callbacks_list = local_callbacks or []
438
-
439
- if isinstance(callbacks_list, BaseCallbackHandler):
440
- callbacks_list = [callbacks_list]
441
- elif not isinstance(callbacks_list, list):
442
- logger.debug("Unknown callback type: %s", callbacks_list)
438
+ local_callbacks = local_callbacks or []
439
+
440
+ # Handle each possible type of local_callbacks. For each type, we
441
+ # extract the list of callbacks to check for SentryLangchainCallback,
442
+ # and define a function that would add the SentryLangchainCallback
443
+ # to the existing callbacks list.
444
+ if isinstance(local_callbacks, BaseCallbackManager):
445
+ callbacks_list = local_callbacks.handlers
446
+ elif isinstance(local_callbacks, BaseCallbackHandler):
447
+ callbacks_list = [local_callbacks]
448
+ elif isinstance(local_callbacks, list):
449
+ callbacks_list = local_callbacks
450
+ else:
451
+ logger.debug("Unknown callback type: %s", local_callbacks)
443
452
  # Just proceed with original function call
444
453
  return f(
445
454
  callback_manager_cls,
@@ -449,28 +458,38 @@ def _wrap_configure(f):
449
458
  **kwargs,
450
459
  )
451
460
 
452
- inheritable_callbacks_list = (
453
- inheritable_callbacks if isinstance(inheritable_callbacks, list) else []
454
- )
461
+ # Handle each possible type of inheritable_callbacks.
462
+ if isinstance(inheritable_callbacks, BaseCallbackManager):
463
+ inheritable_callbacks_list = inheritable_callbacks.handlers
464
+ elif isinstance(inheritable_callbacks, list):
465
+ inheritable_callbacks_list = inheritable_callbacks
466
+ else:
467
+ inheritable_callbacks_list = []
455
468
 
456
469
  if not any(
457
470
  isinstance(cb, SentryLangchainCallback)
458
471
  for cb in itertools.chain(callbacks_list, inheritable_callbacks_list)
459
472
  ):
460
- # Avoid mutating the existing callbacks list
461
- callbacks_list = [
462
- *callbacks_list,
463
- SentryLangchainCallback(
464
- integration.max_spans,
465
- integration.include_prompts,
466
- integration.tiktoken_encoding_name,
467
- ),
468
- ]
473
+ sentry_handler = SentryLangchainCallback(
474
+ integration.max_spans,
475
+ integration.include_prompts,
476
+ integration.tiktoken_encoding_name,
477
+ )
478
+ if isinstance(local_callbacks, BaseCallbackManager):
479
+ local_callbacks = local_callbacks.copy()
480
+ local_callbacks.handlers = [
481
+ *local_callbacks.handlers,
482
+ sentry_handler,
483
+ ]
484
+ elif isinstance(local_callbacks, BaseCallbackHandler):
485
+ local_callbacks = [local_callbacks, sentry_handler]
486
+ else: # local_callbacks is a list
487
+ local_callbacks = [*local_callbacks, sentry_handler]
469
488
 
470
489
  return f(
471
490
  callback_manager_cls,
472
491
  inheritable_callbacks,
473
- callbacks_list,
492
+ local_callbacks,
474
493
  *args,
475
494
  **kwargs,
476
495
  )
@@ -70,48 +70,73 @@ def _capture_exception(exc):
70
70
  sentry_sdk.capture_event(event, hint=hint)
71
71
 
72
72
 
73
- def _calculate_chat_completion_usage(
73
+ def _get_usage(usage, names):
74
+ # type: (Any, List[str]) -> int
75
+ for name in names:
76
+ if hasattr(usage, name) and isinstance(getattr(usage, name), int):
77
+ return getattr(usage, name)
78
+ return 0
79
+
80
+
81
+ def _calculate_token_usage(
74
82
  messages, response, span, streaming_message_responses, count_tokens
75
83
  ):
76
84
  # type: (Iterable[ChatCompletionMessageParam], Any, Span, Optional[List[str]], Callable[..., Any]) -> None
77
- completion_tokens = 0 # type: Optional[int]
78
- prompt_tokens = 0 # type: Optional[int]
85
+ input_tokens = 0 # type: Optional[int]
86
+ input_tokens_cached = 0 # type: Optional[int]
87
+ output_tokens = 0 # type: Optional[int]
88
+ output_tokens_reasoning = 0 # type: Optional[int]
79
89
  total_tokens = 0 # type: Optional[int]
90
+
80
91
  if hasattr(response, "usage"):
81
- if hasattr(response.usage, "completion_tokens") and isinstance(
82
- response.usage.completion_tokens, int
83
- ):
84
- completion_tokens = response.usage.completion_tokens
85
- if hasattr(response.usage, "prompt_tokens") and isinstance(
86
- response.usage.prompt_tokens, int
87
- ):
88
- prompt_tokens = response.usage.prompt_tokens
89
- if hasattr(response.usage, "total_tokens") and isinstance(
90
- response.usage.total_tokens, int
91
- ):
92
- total_tokens = response.usage.total_tokens
92
+ input_tokens = _get_usage(response.usage, ["input_tokens", "prompt_tokens"])
93
+ if hasattr(response.usage, "input_tokens_details"):
94
+ input_tokens_cached = _get_usage(
95
+ response.usage.input_tokens_details, ["cached_tokens"]
96
+ )
93
97
 
94
- if prompt_tokens == 0:
98
+ output_tokens = _get_usage(
99
+ response.usage, ["output_tokens", "completion_tokens"]
100
+ )
101
+ if hasattr(response.usage, "output_tokens_details"):
102
+ output_tokens_reasoning = _get_usage(
103
+ response.usage.output_tokens_details, ["reasoning_tokens"]
104
+ )
105
+
106
+ total_tokens = _get_usage(response.usage, ["total_tokens"])
107
+
108
+ # Manually count tokens
109
+ # TODO: when implementing responses API, check for responses API
110
+ if input_tokens == 0:
95
111
  for message in messages:
96
112
  if "content" in message:
97
- prompt_tokens += count_tokens(message["content"])
113
+ input_tokens += count_tokens(message["content"])
98
114
 
99
- if completion_tokens == 0:
115
+ # TODO: when implementing responses API, check for responses API
116
+ if output_tokens == 0:
100
117
  if streaming_message_responses is not None:
101
118
  for message in streaming_message_responses:
102
- completion_tokens += count_tokens(message)
119
+ output_tokens += count_tokens(message)
103
120
  elif hasattr(response, "choices"):
104
121
  for choice in response.choices:
105
122
  if hasattr(choice, "message"):
106
- completion_tokens += count_tokens(choice.message)
107
-
108
- if prompt_tokens == 0:
109
- prompt_tokens = None
110
- if completion_tokens == 0:
111
- completion_tokens = None
112
- if total_tokens == 0:
113
- total_tokens = None
114
- record_token_usage(span, prompt_tokens, completion_tokens, total_tokens)
123
+ output_tokens += count_tokens(choice.message)
124
+
125
+ # Do not set token data if it is 0
126
+ input_tokens = input_tokens or None
127
+ input_tokens_cached = input_tokens_cached or None
128
+ output_tokens = output_tokens or None
129
+ output_tokens_reasoning = output_tokens_reasoning or None
130
+ total_tokens = total_tokens or None
131
+
132
+ record_token_usage(
133
+ span,
134
+ input_tokens=input_tokens,
135
+ input_tokens_cached=input_tokens_cached,
136
+ output_tokens=output_tokens,
137
+ output_tokens_reasoning=output_tokens_reasoning,
138
+ total_tokens=total_tokens,
139
+ )
115
140
 
116
141
 
117
142
  def _new_chat_completion_common(f, *args, **kwargs):
@@ -158,9 +183,7 @@ def _new_chat_completion_common(f, *args, **kwargs):
158
183
  SPANDATA.AI_RESPONSES,
159
184
  list(map(lambda x: x.message, res.choices)),
160
185
  )
161
- _calculate_chat_completion_usage(
162
- messages, res, span, None, integration.count_tokens
163
- )
186
+ _calculate_token_usage(messages, res, span, None, integration.count_tokens)
164
187
  span.__exit__(None, None, None)
165
188
  elif hasattr(res, "_iterator"):
166
189
  data_buf: list[list[str]] = [] # one for each choice
@@ -191,7 +214,7 @@ def _new_chat_completion_common(f, *args, **kwargs):
191
214
  set_data_normalized(
192
215
  span, SPANDATA.AI_RESPONSES, all_responses
193
216
  )
194
- _calculate_chat_completion_usage(
217
+ _calculate_token_usage(
195
218
  messages,
196
219
  res,
197
220
  span,
@@ -224,7 +247,7 @@ def _new_chat_completion_common(f, *args, **kwargs):
224
247
  set_data_normalized(
225
248
  span, SPANDATA.AI_RESPONSES, all_responses
226
249
  )
227
- _calculate_chat_completion_usage(
250
+ _calculate_token_usage(
228
251
  messages,
229
252
  res,
230
253
  span,
@@ -341,22 +364,26 @@ def _new_embeddings_create_common(f, *args, **kwargs):
341
364
 
342
365
  response = yield f, args, kwargs
343
366
 
344
- prompt_tokens = 0
367
+ input_tokens = 0
345
368
  total_tokens = 0
346
369
  if hasattr(response, "usage"):
347
370
  if hasattr(response.usage, "prompt_tokens") and isinstance(
348
371
  response.usage.prompt_tokens, int
349
372
  ):
350
- prompt_tokens = response.usage.prompt_tokens
373
+ input_tokens = response.usage.prompt_tokens
351
374
  if hasattr(response.usage, "total_tokens") and isinstance(
352
375
  response.usage.total_tokens, int
353
376
  ):
354
377
  total_tokens = response.usage.total_tokens
355
378
 
356
- if prompt_tokens == 0:
357
- prompt_tokens = integration.count_tokens(kwargs["input"] or "")
379
+ if input_tokens == 0:
380
+ input_tokens = integration.count_tokens(kwargs["input"] or "")
358
381
 
359
- record_token_usage(span, prompt_tokens, None, total_tokens or prompt_tokens)
382
+ record_token_usage(
383
+ span,
384
+ input_tokens=input_tokens,
385
+ total_tokens=total_tokens or input_tokens,
386
+ )
360
387
 
361
388
  return response
362
389
 
@@ -19,9 +19,10 @@ if TYPE_CHECKING:
19
19
  def ai_client_span(agent, get_response_kwargs):
20
20
  # type: (Agent, dict[str, Any]) -> sentry_sdk.tracing.Span
21
21
  # TODO-anton: implement other types of operations. Now "chat" is hardcoded.
22
+ model_name = agent.model.model if hasattr(agent.model, "model") else agent.model
22
23
  span = sentry_sdk.start_span(
23
24
  op=OP.GEN_AI_CHAT,
24
- description=f"chat {agent.model}",
25
+ description=f"chat {model_name}",
25
26
  origin=SPAN_ORIGIN,
26
27
  )
27
28
  # TODO-anton: remove hardcoded stuff and replace something that also works for embedding and so on
@@ -53,7 +53,8 @@ def _set_agent_data(span, agent):
53
53
  )
54
54
 
55
55
  if agent.model:
56
- span.set_data(SPANDATA.GEN_AI_REQUEST_MODEL, agent.model)
56
+ model_name = agent.model.model if hasattr(agent.model, "model") else agent.model
57
+ span.set_data(SPANDATA.GEN_AI_REQUEST_MODEL, model_name)
57
58
 
58
59
  if agent.model_settings.presence_penalty:
59
60
  span.set_data(
@@ -118,7 +118,3 @@ class Monitor:
118
118
  def kill(self):
119
119
  # type: () -> None
120
120
  self._running = False
121
-
122
- def __del__(self):
123
- # type: () -> None
124
- self.kill()
@@ -1,7 +1,6 @@
1
1
  import os
2
- import time
3
2
  import warnings
4
- from threading import Thread, Lock
3
+ from threading import Thread, Lock, Event
5
4
  from contextlib import contextmanager
6
5
 
7
6
  import sentry_sdk
@@ -162,7 +161,7 @@ class SessionFlusher:
162
161
  self._thread_lock = Lock()
163
162
  self._aggregate_lock = Lock()
164
163
  self._thread_for_pid = None # type: Optional[int]
165
- self._running = True
164
+ self.__shutdown_requested = Event()
166
165
 
167
166
  def flush(self):
168
167
  # type: (...) -> None
@@ -208,10 +207,10 @@ class SessionFlusher:
208
207
 
209
208
  def _thread():
210
209
  # type: (...) -> None
211
- while self._running:
212
- time.sleep(self.flush_interval)
213
- if self._running:
214
- self.flush()
210
+ running = True
211
+ while running:
212
+ running = not self.__shutdown_requested.wait(self.flush_interval)
213
+ self.flush()
215
214
 
216
215
  thread = Thread(target=_thread)
217
216
  thread.daemon = True
@@ -220,7 +219,7 @@ class SessionFlusher:
220
219
  except RuntimeError:
221
220
  # Unfortunately at this point the interpreter is in a state that no
222
221
  # longer allows us to spawn a thread and we have to bail.
223
- self._running = False
222
+ self.__shutdown_requested.set()
224
223
  return None
225
224
 
226
225
  self._thread = thread
@@ -271,8 +270,4 @@ class SessionFlusher:
271
270
 
272
271
  def kill(self):
273
272
  # type: (...) -> None
274
- self._running = False
275
-
276
- def __del__(self):
277
- # type: (...) -> None
278
- self.kill()
273
+ self.__shutdown_requested.set()
@@ -158,13 +158,6 @@ class Transport(ABC):
158
158
  # type: (Self) -> bool
159
159
  return True
160
160
 
161
- def __del__(self):
162
- # type: (Self) -> None
163
- try:
164
- self.kill()
165
- except Exception:
166
- pass
167
-
168
161
 
169
162
  def _parse_rate_limits(header, now=None):
170
163
  # type: (str, Optional[datetime]) -> Iterable[Tuple[Optional[EventDataCategory], datetime]]
@@ -591,9 +591,14 @@ def serialize_frame(
591
591
  if tb_lineno is None:
592
592
  tb_lineno = frame.f_lineno
593
593
 
594
+ try:
595
+ os_abs_path = os.path.abspath(abs_path) if abs_path else None
596
+ except Exception:
597
+ os_abs_path = None
598
+
594
599
  rv = {
595
600
  "filename": filename_for_module(module, abs_path) or None,
596
- "abs_path": os.path.abspath(abs_path) if abs_path else None,
601
+ "abs_path": os_abs_path,
597
602
  "function": function or "<unknown>",
598
603
  "module": module,
599
604
  "lineno": tb_lineno,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sentry-sdk
3
- Version: 2.32.0
3
+ Version: 2.33.1
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
@@ -181,6 +181,7 @@ tests/test_envelope.py
181
181
  tests/test_exceptiongroup.py
182
182
  tests/test_feature_flags.py
183
183
  tests/test_full_stack_frames.py
184
+ tests/test_gevent.py
184
185
  tests/test_import.py
185
186
  tests/test_logs.py
186
187
  tests/test_lru_cache.py
@@ -21,7 +21,7 @@ def get_file_text(file_name):
21
21
 
22
22
  setup(
23
23
  name="sentry-sdk",
24
- version="2.32.0",
24
+ version="2.33.1",
25
25
  author="Sentry Team and Contributors",
26
26
  author_email="hello@sentry.io",
27
27
  url="https://github.com/getsentry/sentry-python",
@@ -119,3 +119,44 @@ async def test_ai_track_async_with_tags(sentry_init, capture_events):
119
119
  assert ai_pipeline_span["tags"]["user"] == "czyber"
120
120
  assert ai_pipeline_span["data"]["some_data"] == "value"
121
121
  assert ai_run_span["description"] == "my async tool"
122
+
123
+
124
+ def test_ai_track_with_explicit_op(sentry_init, capture_events):
125
+ sentry_init(traces_sample_rate=1.0)
126
+ events = capture_events()
127
+
128
+ @ai_track("my tool", op="custom.operation")
129
+ def tool(**kwargs):
130
+ pass
131
+
132
+ with sentry_sdk.start_transaction():
133
+ tool()
134
+
135
+ transaction = events[0]
136
+ assert transaction["type"] == "transaction"
137
+ assert len(transaction["spans"]) == 1
138
+ span = transaction["spans"][0]
139
+
140
+ assert span["description"] == "my tool"
141
+ assert span["op"] == "custom.operation"
142
+
143
+
144
+ @pytest.mark.asyncio
145
+ async def test_ai_track_async_with_explicit_op(sentry_init, capture_events):
146
+ sentry_init(traces_sample_rate=1.0)
147
+ events = capture_events()
148
+
149
+ @ai_track("my async tool", op="custom.async.operation")
150
+ async def async_tool(**kwargs):
151
+ pass
152
+
153
+ with sentry_sdk.start_transaction():
154
+ await async_tool()
155
+
156
+ transaction = events[0]
157
+ assert transaction["type"] == "transaction"
158
+ assert len(transaction["spans"]) == 1
159
+ span = transaction["spans"][0]
160
+
161
+ assert span["description"] == "my async tool"
162
+ assert span["op"] == "custom.async.operation"