sentry-sdk 0.7.5__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 -30
  2. sentry_sdk/_compat.py +74 -61
  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 +289 -0
  8. sentry_sdk/_types.py +338 -0
  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 +496 -80
  14. sentry_sdk/attachments.py +75 -0
  15. sentry_sdk/client.py +1023 -103
  16. sentry_sdk/consts.py +1438 -66
  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 +15 -14
  22. sentry_sdk/envelope.py +369 -0
  23. sentry_sdk/feature_flags.py +71 -0
  24. sentry_sdk/hub.py +611 -280
  25. sentry_sdk/integrations/__init__.py +276 -49
  26. sentry_sdk/integrations/_asgi_common.py +108 -0
  27. sentry_sdk/integrations/_wsgi_common.py +180 -44
  28. sentry_sdk/integrations/aiohttp.py +291 -42
  29. sentry_sdk/integrations/anthropic.py +439 -0
  30. sentry_sdk/integrations/argv.py +9 -8
  31. sentry_sdk/integrations/ariadne.py +161 -0
  32. sentry_sdk/integrations/arq.py +247 -0
  33. sentry_sdk/integrations/asgi.py +341 -0
  34. sentry_sdk/integrations/asyncio.py +144 -0
  35. sentry_sdk/integrations/asyncpg.py +208 -0
  36. sentry_sdk/integrations/atexit.py +17 -10
  37. sentry_sdk/integrations/aws_lambda.py +377 -62
  38. sentry_sdk/integrations/beam.py +176 -0
  39. sentry_sdk/integrations/boto3.py +137 -0
  40. sentry_sdk/integrations/bottle.py +221 -0
  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 +134 -0
  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 +48 -14
  49. sentry_sdk/integrations/django/__init__.py +584 -191
  50. sentry_sdk/integrations/django/asgi.py +245 -0
  51. sentry_sdk/integrations/django/caching.py +204 -0
  52. sentry_sdk/integrations/django/middleware.py +187 -0
  53. sentry_sdk/integrations/django/signals_handlers.py +91 -0
  54. sentry_sdk/integrations/django/templates.py +79 -5
  55. sentry_sdk/integrations/django/transactions.py +49 -22
  56. sentry_sdk/integrations/django/views.py +96 -0
  57. sentry_sdk/integrations/dramatiq.py +226 -0
  58. sentry_sdk/integrations/excepthook.py +50 -13
  59. sentry_sdk/integrations/executing.py +67 -0
  60. sentry_sdk/integrations/falcon.py +272 -0
  61. sentry_sdk/integrations/fastapi.py +141 -0
  62. sentry_sdk/integrations/flask.py +142 -88
  63. sentry_sdk/integrations/gcp.py +239 -0
  64. sentry_sdk/integrations/gnu_backtrace.py +99 -0
  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 +307 -96
  87. sentry_sdk/integrations/loguru.py +213 -0
  88. sentry_sdk/integrations/mcp.py +566 -0
  89. sentry_sdk/integrations/modules.py +14 -31
  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 +141 -0
  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 +112 -68
  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 +95 -37
  143. sentry_sdk/integrations/rust_tracing.py +284 -0
  144. sentry_sdk/integrations/sanic.py +294 -123
  145. sentry_sdk/integrations/serverless.py +48 -19
  146. sentry_sdk/integrations/socket.py +96 -0
  147. sentry_sdk/integrations/spark/__init__.py +4 -0
  148. sentry_sdk/integrations/spark/spark_driver.py +316 -0
  149. sentry_sdk/integrations/spark/spark_worker.py +116 -0
  150. sentry_sdk/integrations/sqlalchemy.py +142 -0
  151. sentry_sdk/integrations/starlette.py +737 -0
  152. sentry_sdk/integrations/starlite.py +292 -0
  153. sentry_sdk/integrations/statsig.py +37 -0
  154. sentry_sdk/integrations/stdlib.py +235 -29
  155. sentry_sdk/integrations/strawberry.py +394 -0
  156. sentry_sdk/integrations/sys_exit.py +70 -0
  157. sentry_sdk/integrations/threading.py +158 -28
  158. sentry_sdk/integrations/tornado.py +84 -52
  159. sentry_sdk/integrations/trytond.py +50 -0
  160. sentry_sdk/integrations/typer.py +60 -0
  161. sentry_sdk/integrations/unleash.py +33 -0
  162. sentry_sdk/integrations/unraisablehook.py +53 -0
  163. sentry_sdk/integrations/wsgi.py +201 -119
  164. sentry_sdk/logger.py +96 -0
  165. sentry_sdk/metrics.py +81 -0
  166. sentry_sdk/monitor.py +120 -0
  167. sentry_sdk/profiler/__init__.py +49 -0
  168. sentry_sdk/profiler/continuous_profiler.py +730 -0
  169. sentry_sdk/profiler/transaction_profiler.py +839 -0
  170. sentry_sdk/profiler/utils.py +195 -0
  171. sentry_sdk/py.typed +0 -0
  172. sentry_sdk/scope.py +1713 -85
  173. sentry_sdk/scrubber.py +177 -0
  174. sentry_sdk/serializer.py +405 -0
  175. sentry_sdk/session.py +177 -0
  176. sentry_sdk/sessions.py +275 -0
  177. sentry_sdk/spotlight.py +242 -0
  178. sentry_sdk/tracing.py +1486 -0
  179. sentry_sdk/tracing_utils.py +1236 -0
  180. sentry_sdk/transport.py +806 -134
  181. sentry_sdk/types.py +52 -0
  182. sentry_sdk/utils.py +1625 -465
  183. sentry_sdk/worker.py +54 -25
  184. sentry_sdk-2.46.0.dist-info/METADATA +268 -0
  185. sentry_sdk-2.46.0.dist-info/RECORD +189 -0
  186. {sentry_sdk-0.7.5.dist-info → sentry_sdk-2.46.0.dist-info}/WHEEL +1 -1
  187. sentry_sdk-2.46.0.dist-info/entry_points.txt +2 -0
  188. sentry_sdk-2.46.0.dist-info/licenses/LICENSE +21 -0
  189. sentry_sdk/integrations/celery.py +0 -119
  190. sentry_sdk-0.7.5.dist-info/LICENSE +0 -9
  191. sentry_sdk-0.7.5.dist-info/METADATA +0 -36
  192. sentry_sdk-0.7.5.dist-info/RECORD +0 -39
  193. {sentry_sdk-0.7.5.dist-info → sentry_sdk-2.46.0.dist-info}/top_level.txt +0 -0
sentry_sdk/consts.py CHANGED
@@ -1,79 +1,1451 @@
1
- import socket
1
+ import itertools
2
+ from enum import Enum
3
+ from typing import TYPE_CHECKING
4
+
5
+ # up top to prevent circular import due to integration import
6
+ # This is more or less an arbitrary large-ish value for now, so that we allow
7
+ # pretty long strings (like LLM prompts), but still have *some* upper limit
8
+ # until we verify that removing the trimming completely is safe.
9
+ DEFAULT_MAX_VALUE_LENGTH = 100_000
10
+
11
+ DEFAULT_MAX_STACK_FRAMES = 100
12
+ DEFAULT_ADD_FULL_STACK = False
13
+
14
+
15
+ # Also needs to be at the top to prevent circular import
16
+ class EndpointType(Enum):
17
+ """
18
+ The type of an endpoint. This is an enum, rather than a constant, for historical reasons
19
+ (the old /store endpoint). The enum also preserve future compatibility, in case we ever
20
+ have a new endpoint.
21
+ """
22
+
23
+ ENVELOPE = "envelope"
24
+ OTLP_TRACES = "integration/otlp/v1/traces"
25
+
26
+
27
+ class CompressionAlgo(Enum):
28
+ GZIP = "gzip"
29
+ BROTLI = "br"
30
+
31
+
32
+ if TYPE_CHECKING:
33
+ import sentry_sdk
2
34
 
3
- if False:
4
- from mypy_extensions import TypedDict
5
35
  from typing import Optional
6
36
  from typing import Callable
7
37
  from typing import Union
8
38
  from typing import List
39
+ from typing import Type
40
+ from typing import Dict
41
+ from typing import Any
42
+ from typing import Sequence
43
+ from typing import Tuple
44
+ from typing import AbstractSet
45
+ from typing_extensions import Literal
46
+ from typing_extensions import TypedDict
9
47
 
10
- from sentry_sdk.transport import Transport
11
- from sentry_sdk.integrations import Integration
48
+ from sentry_sdk._types import (
49
+ BreadcrumbProcessor,
50
+ ContinuousProfilerMode,
51
+ Event,
52
+ EventProcessor,
53
+ Hint,
54
+ Log,
55
+ MeasurementUnit,
56
+ Metric,
57
+ ProfilerMode,
58
+ TracesSampler,
59
+ TransactionProcessor,
60
+ )
12
61
 
13
- ClientOptions = TypedDict(
14
- "ClientOptions",
62
+ # Experiments are feature flags to enable and disable certain unstable SDK
63
+ # functionality. Changing them from the defaults (`None`) in production
64
+ # code is highly discouraged. They are not subject to any stability
65
+ # guarantees such as the ones from semantic versioning.
66
+ Experiments = TypedDict(
67
+ "Experiments",
15
68
  {
16
- "dsn": Optional[str],
17
- "with_locals": bool,
18
- "max_breadcrumbs": int,
19
- "release": Optional[str],
20
- "environment": Optional[str],
21
- "server_name": Optional[str],
22
- "shutdown_timeout": int,
23
- "integrations": List[Integration],
24
- "in_app_include": List[str],
25
- "in_app_exclude": List[str],
26
- "default_integrations": bool,
27
- "dist": Optional[str],
28
- "transport": Optional[Union[Transport, type, Callable]],
29
- "sample_rate": int,
30
- "send_default_pii": bool,
31
- "http_proxy": Optional[str],
32
- "https_proxy": Optional[str],
33
- "ignore_errors": List[type],
34
- "request_bodies": str,
35
- "before_send": Optional[Callable],
36
- "before_breadcrumb": Optional[Callable],
37
- "debug": bool,
38
- "attach_stacktrace": bool,
39
- "ca_certs": Optional[str],
69
+ "max_spans": Optional[int],
70
+ "max_flags": Optional[int],
71
+ "record_sql_params": Optional[bool],
72
+ "continuous_profiling_auto_start": Optional[bool],
73
+ "continuous_profiling_mode": Optional[ContinuousProfilerMode],
74
+ "otel_powered_performance": Optional[bool],
75
+ "transport_zlib_compression_level": Optional[int],
76
+ "transport_compression_level": Optional[int],
77
+ "transport_compression_algo": Optional[CompressionAlgo],
78
+ "transport_num_pools": Optional[int],
79
+ "transport_http2": Optional[bool],
80
+ "enable_logs": Optional[bool],
81
+ "before_send_log": Optional[Callable[[Log, Hint], Optional[Log]]],
82
+ "enable_metrics": Optional[bool],
83
+ "before_send_metric": Optional[Callable[[Metric, Hint], Optional[Metric]]],
40
84
  },
41
85
  total=False,
42
86
  )
43
87
 
88
+ DEFAULT_QUEUE_SIZE = 100
89
+ DEFAULT_MAX_BREADCRUMBS = 100
90
+ MATCH_ALL = r".*"
91
+
92
+ FALSE_VALUES = [
93
+ "false",
94
+ "no",
95
+ "off",
96
+ "n",
97
+ "0",
98
+ ]
99
+
100
+
101
+ class SPANTEMPLATE(str, Enum):
102
+ DEFAULT = "default"
103
+ AI_AGENT = "ai_agent"
104
+ AI_TOOL = "ai_tool"
105
+ AI_CHAT = "ai_chat"
106
+
107
+ def __str__(self):
108
+ # type: () -> str
109
+ return self.value
110
+
111
+
112
+ class INSTRUMENTER:
113
+ SENTRY = "sentry"
114
+ OTEL = "otel"
115
+
116
+
117
+ class SPANDATA:
118
+ """
119
+ Additional information describing the type of the span.
120
+ See: https://develop.sentry.dev/sdk/performance/span-data-conventions/
121
+ """
122
+
123
+ AI_CITATIONS = "ai.citations"
124
+ """
125
+ .. deprecated::
126
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
127
+
128
+ References or sources cited by the AI model in its response.
129
+ Example: ["Smith et al. 2020", "Jones 2019"]
130
+ """
131
+
132
+ AI_DOCUMENTS = "ai.documents"
133
+ """
134
+ .. deprecated::
135
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
136
+
137
+ Documents or content chunks used as context for the AI model.
138
+ Example: ["doc1.txt", "doc2.pdf"]
139
+ """
140
+
141
+ AI_FINISH_REASON = "ai.finish_reason"
142
+ """
143
+ .. deprecated::
144
+ This attribute is deprecated. Use GEN_AI_RESPONSE_FINISH_REASONS instead.
145
+
146
+ The reason why the model stopped generating.
147
+ Example: "length"
148
+ """
149
+
150
+ AI_FREQUENCY_PENALTY = "ai.frequency_penalty"
151
+ """
152
+ .. deprecated::
153
+ This attribute is deprecated. Use GEN_AI_REQUEST_FREQUENCY_PENALTY instead.
154
+
155
+ Used to reduce repetitiveness of generated tokens.
156
+ Example: 0.5
157
+ """
158
+
159
+ AI_FUNCTION_CALL = "ai.function_call"
160
+ """
161
+ .. deprecated::
162
+ This attribute is deprecated. Use GEN_AI_RESPONSE_TOOL_CALLS instead.
163
+
164
+ For an AI model call, the function that was called. This is deprecated for OpenAI, and replaced by tool_calls
165
+ """
166
+
167
+ AI_GENERATION_ID = "ai.generation_id"
168
+ """
169
+ .. deprecated::
170
+ This attribute is deprecated. Use GEN_AI_RESPONSE_ID instead.
171
+
172
+ Unique identifier for the completion.
173
+ Example: "gen_123abc"
174
+ """
175
+
176
+ AI_INPUT_MESSAGES = "ai.input_messages"
177
+ """
178
+ .. deprecated::
179
+ This attribute is deprecated. Use GEN_AI_REQUEST_MESSAGES instead.
180
+
181
+ The input messages to an LLM call.
182
+ Example: [{"role": "user", "message": "hello"}]
183
+ """
184
+
185
+ AI_LOGIT_BIAS = "ai.logit_bias"
186
+ """
187
+ .. deprecated::
188
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
189
+
190
+ For an AI model call, the logit bias
191
+ """
192
+
193
+ AI_METADATA = "ai.metadata"
194
+ """
195
+ .. deprecated::
196
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
197
+
198
+ Extra metadata passed to an AI pipeline step.
199
+ Example: {"executed_function": "add_integers"}
200
+ """
201
+
202
+ AI_MODEL_ID = "ai.model_id"
203
+ """
204
+ .. deprecated::
205
+ This attribute is deprecated. Use GEN_AI_REQUEST_MODEL or GEN_AI_RESPONSE_MODEL instead.
206
+
207
+ The unique descriptor of the model being executed.
208
+ Example: gpt-4
209
+ """
210
+
211
+ AI_PIPELINE_NAME = "ai.pipeline.name"
212
+ """
213
+ .. deprecated::
214
+ This attribute is deprecated. Use GEN_AI_PIPELINE_NAME instead.
215
+
216
+ Name of the AI pipeline or chain being executed.
217
+ Example: "qa-pipeline"
218
+ """
219
+
220
+ AI_PREAMBLE = "ai.preamble"
221
+ """
222
+ .. deprecated::
223
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
224
+
225
+ For an AI model call, the preamble parameter.
226
+ Preambles are a part of the prompt used to adjust the model's overall behavior and conversation style.
227
+ Example: "You are now a clown."
228
+ """
229
+
230
+ AI_PRESENCE_PENALTY = "ai.presence_penalty"
231
+ """
232
+ .. deprecated::
233
+ This attribute is deprecated. Use GEN_AI_REQUEST_PRESENCE_PENALTY instead.
234
+
235
+ Used to reduce repetitiveness of generated tokens.
236
+ Example: 0.5
237
+ """
238
+
239
+ AI_RAW_PROMPTING = "ai.raw_prompting"
240
+ """
241
+ .. deprecated::
242
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
243
+
244
+ Minimize pre-processing done to the prompt sent to the LLM.
245
+ Example: true
246
+ """
247
+
248
+ AI_RESPONSE_FORMAT = "ai.response_format"
249
+ """
250
+ .. deprecated::
251
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
252
+
253
+ For an AI model call, the format of the response
254
+ """
255
+
256
+ AI_RESPONSES = "ai.responses"
257
+ """
258
+ .. deprecated::
259
+ This attribute is deprecated. Use GEN_AI_RESPONSE_TEXT instead.
260
+
261
+ The responses to an AI model call. Always as a list.
262
+ Example: ["hello", "world"]
263
+ """
264
+
265
+ AI_SEARCH_QUERIES = "ai.search_queries"
266
+ """
267
+ .. deprecated::
268
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
269
+
270
+ Queries used to search for relevant context or documents.
271
+ Example: ["climate change effects", "renewable energy"]
272
+ """
273
+
274
+ AI_SEARCH_REQUIRED = "ai.is_search_required"
275
+ """
276
+ .. deprecated::
277
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
278
+
279
+ Boolean indicating if the model needs to perform a search.
280
+ Example: true
281
+ """
282
+
283
+ AI_SEARCH_RESULTS = "ai.search_results"
284
+ """
285
+ .. deprecated::
286
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
287
+
288
+ Results returned from search queries for context.
289
+ Example: ["Result 1", "Result 2"]
290
+ """
291
+
292
+ AI_SEED = "ai.seed"
293
+ """
294
+ .. deprecated::
295
+ This attribute is deprecated. Use GEN_AI_REQUEST_SEED instead.
296
+
297
+ The seed, ideally models given the same seed and same other parameters will produce the exact same output.
298
+ Example: 123.45
299
+ """
300
+
301
+ AI_STREAMING = "ai.streaming"
302
+ """
303
+ .. deprecated::
304
+ This attribute is deprecated. Use GEN_AI_RESPONSE_STREAMING instead.
305
+
306
+ Whether or not the AI model call's response was streamed back asynchronously
307
+ Example: true
308
+ """
309
+
310
+ AI_TAGS = "ai.tags"
311
+ """
312
+ .. deprecated::
313
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
314
+
315
+ Tags that describe an AI pipeline step.
316
+ Example: {"executed_function": "add_integers"}
317
+ """
318
+
319
+ AI_TEMPERATURE = "ai.temperature"
320
+ """
321
+ .. deprecated::
322
+ This attribute is deprecated. Use GEN_AI_REQUEST_TEMPERATURE instead.
323
+
324
+ For an AI model call, the temperature parameter. Temperature essentially means how random the output will be.
325
+ Example: 0.5
326
+ """
327
+
328
+ AI_TEXTS = "ai.texts"
329
+ """
330
+ .. deprecated::
331
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
332
+
333
+ Raw text inputs provided to the model.
334
+ Example: ["What is machine learning?"]
335
+ """
336
+
337
+ AI_TOP_K = "ai.top_k"
338
+ """
339
+ .. deprecated::
340
+ This attribute is deprecated. Use GEN_AI_REQUEST_TOP_K instead.
341
+
342
+ For an AI model call, the top_k parameter. Top_k essentially controls how random the output will be.
343
+ Example: 35
344
+ """
345
+
346
+ AI_TOP_P = "ai.top_p"
347
+ """
348
+ .. deprecated::
349
+ This attribute is deprecated. Use GEN_AI_REQUEST_TOP_P instead.
350
+
351
+ For an AI model call, the top_p parameter. Top_p essentially controls how random the output will be.
352
+ Example: 0.5
353
+ """
354
+
355
+ AI_TOOL_CALLS = "ai.tool_calls"
356
+ """
357
+ .. deprecated::
358
+ This attribute is deprecated. Use GEN_AI_RESPONSE_TOOL_CALLS instead.
359
+
360
+ For an AI model call, the function that was called. This is deprecated for OpenAI, and replaced by tool_calls
361
+ """
362
+
363
+ AI_TOOLS = "ai.tools"
364
+ """
365
+ .. deprecated::
366
+ This attribute is deprecated. Use GEN_AI_REQUEST_AVAILABLE_TOOLS instead.
367
+
368
+ For an AI model call, the functions that are available
369
+ """
370
+
371
+ AI_WARNINGS = "ai.warnings"
372
+ """
373
+ .. deprecated::
374
+ This attribute is deprecated. Use GEN_AI_* attributes instead.
375
+
376
+ Warning messages generated during model execution.
377
+ Example: ["Token limit exceeded"]
378
+ """
379
+
380
+ CACHE_HIT = "cache.hit"
381
+ """
382
+ A boolean indicating whether the requested data was found in the cache.
383
+ Example: true
384
+ """
385
+
386
+ CACHE_ITEM_SIZE = "cache.item_size"
387
+ """
388
+ The size of the requested data in bytes.
389
+ Example: 58
390
+ """
391
+
392
+ CACHE_KEY = "cache.key"
393
+ """
394
+ The key of the requested data.
395
+ Example: template.cache.some_item.867da7e2af8e6b2f3aa7213a4080edb3
396
+ """
397
+
398
+ CODE_FILEPATH = "code.filepath"
399
+ """
400
+ The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path).
401
+ Example: "/app/myapplication/http/handler/server.py"
402
+ """
403
+
404
+ CODE_FUNCTION = "code.function"
405
+ """
406
+ The method or function name, or equivalent (usually rightmost part of the code unit's name).
407
+ Example: "server_request"
408
+ """
409
+
410
+ CODE_LINENO = "code.lineno"
411
+ """
412
+ The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`.
413
+ Example: 42
414
+ """
415
+
416
+ CODE_NAMESPACE = "code.namespace"
417
+ """
418
+ The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit.
419
+ Example: "http.handler"
420
+ """
421
+
422
+ DB_MONGODB_COLLECTION = "db.mongodb.collection"
423
+ """
424
+ The MongoDB collection being accessed within the database.
425
+ See: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/mongodb.md#attributes
426
+ Example: public.users; customers
427
+ """
428
+
429
+ DB_NAME = "db.name"
430
+ """
431
+ The name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails).
432
+ Example: myDatabase
433
+ """
434
+
435
+ DB_OPERATION = "db.operation"
436
+ """
437
+ The name of the operation being executed, e.g. the MongoDB command name such as findAndModify, or the SQL keyword.
438
+ See: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md
439
+ Example: findAndModify, HMSET, SELECT
440
+ """
441
+
442
+ DB_SYSTEM = "db.system"
443
+ """
444
+ An identifier for the database management system (DBMS) product being used.
445
+ See: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md
446
+ Example: postgresql
447
+ """
448
+
449
+ DB_USER = "db.user"
450
+ """
451
+ The name of the database user used for connecting to the database.
452
+ See: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/database.md
453
+ Example: my_user
454
+ """
455
+
456
+ GEN_AI_AGENT_NAME = "gen_ai.agent.name"
457
+ """
458
+ The name of the agent being used.
459
+ Example: "ResearchAssistant"
460
+ """
461
+
462
+ GEN_AI_CHOICE = "gen_ai.choice"
463
+ """
464
+ The model's response message.
465
+ Example: "The weather in Paris is rainy and overcast, with temperatures around 57°F"
466
+ """
467
+
468
+ GEN_AI_EMBEDDINGS_INPUT = "gen_ai.embeddings.input"
469
+ """
470
+ The input to the embeddings operation.
471
+ Example: "Hello!"
472
+ """
473
+
474
+ GEN_AI_OPERATION_NAME = "gen_ai.operation.name"
475
+ """
476
+ The name of the operation being performed.
477
+ Example: "chat"
478
+ """
479
+
480
+ GEN_AI_PIPELINE_NAME = "gen_ai.pipeline.name"
481
+ """
482
+ Name of the AI pipeline or chain being executed.
483
+ Example: "qa-pipeline"
484
+ """
485
+
486
+ GEN_AI_RESPONSE_FINISH_REASONS = "gen_ai.response.finish_reasons"
487
+ """
488
+ The reason why the model stopped generating.
489
+ Example: "COMPLETE"
490
+ """
491
+
492
+ GEN_AI_RESPONSE_ID = "gen_ai.response.id"
493
+ """
494
+ Unique identifier for the completion.
495
+ Example: "gen_123abc"
496
+ """
497
+
498
+ GEN_AI_RESPONSE_MODEL = "gen_ai.response.model"
499
+ """
500
+ Exact model identifier used to generate the response
501
+ Example: gpt-4o-mini-2024-07-18
502
+ """
503
+
504
+ GEN_AI_RESPONSE_STREAMING = "gen_ai.response.streaming"
505
+ """
506
+ Whether or not the AI model call's response was streamed back asynchronously
507
+ Example: true
508
+ """
509
+
510
+ GEN_AI_RESPONSE_TEXT = "gen_ai.response.text"
511
+ """
512
+ The model's response text messages.
513
+ Example: ["The weather in Paris is rainy and overcast, with temperatures around 57°F", "The weather in London is sunny and warm, with temperatures around 65°F"]
514
+ """
515
+
516
+ GEN_AI_RESPONSE_TOOL_CALLS = "gen_ai.response.tool_calls"
517
+ """
518
+ The tool calls in the model's response.
519
+ Example: [{"name": "get_weather", "arguments": {"location": "Paris"}}]
520
+ """
521
+
522
+ GEN_AI_REQUEST_AVAILABLE_TOOLS = "gen_ai.request.available_tools"
523
+ """
524
+ The available tools for the model.
525
+ Example: [{"name": "get_weather", "description": "Get the weather for a given location"}, {"name": "get_news", "description": "Get the news for a given topic"}]
526
+ """
527
+
528
+ GEN_AI_REQUEST_FREQUENCY_PENALTY = "gen_ai.request.frequency_penalty"
529
+ """
530
+ The frequency penalty parameter used to reduce repetitiveness of generated tokens.
531
+ Example: 0.1
532
+ """
533
+
534
+ GEN_AI_REQUEST_MAX_TOKENS = "gen_ai.request.max_tokens"
535
+ """
536
+ The maximum number of tokens to generate in the response.
537
+ Example: 2048
538
+ """
539
+
540
+ GEN_AI_REQUEST_MESSAGES = "gen_ai.request.messages"
541
+ """
542
+ The messages passed to the model. The "content" can be a string or an array of objects.
543
+ Example: [{role: "system", "content: "Generate a random number."}, {"role": "user", "content": [{"text": "Generate a random number between 0 and 10.", "type": "text"}]}]
544
+ """
545
+
546
+ GEN_AI_REQUEST_MODEL = "gen_ai.request.model"
547
+ """
548
+ The model identifier being used for the request.
549
+ Example: "gpt-4-turbo"
550
+ """
551
+
552
+ GEN_AI_REQUEST_PRESENCE_PENALTY = "gen_ai.request.presence_penalty"
553
+ """
554
+ The presence penalty parameter used to reduce repetitiveness of generated tokens.
555
+ Example: 0.1
556
+ """
557
+
558
+ GEN_AI_REQUEST_SEED = "gen_ai.request.seed"
559
+ """
560
+ The seed, ideally models given the same seed and same other parameters will produce the exact same output.
561
+ Example: "1234567890"
562
+ """
563
+
564
+ GEN_AI_REQUEST_TEMPERATURE = "gen_ai.request.temperature"
565
+ """
566
+ The temperature parameter used to control randomness in the output.
567
+ Example: 0.7
568
+ """
569
+
570
+ GEN_AI_REQUEST_TOP_K = "gen_ai.request.top_k"
571
+ """
572
+ Limits the model to only consider the K most likely next tokens, where K is an integer (e.g., top_k=20 means only the 20 highest probability tokens are considered).
573
+ Example: 35
574
+ """
575
+
576
+ GEN_AI_REQUEST_TOP_P = "gen_ai.request.top_p"
577
+ """
578
+ The top_p parameter used to control diversity via nucleus sampling.
579
+ Example: 1.0
580
+ """
581
+
582
+ GEN_AI_SYSTEM = "gen_ai.system"
583
+ """
584
+ The name of the AI system being used.
585
+ Example: "openai"
586
+ """
587
+
588
+ GEN_AI_TOOL_DESCRIPTION = "gen_ai.tool.description"
589
+ """
590
+ The description of the tool being used.
591
+ Example: "Searches the web for current information about a topic"
592
+ """
593
+
594
+ GEN_AI_TOOL_INPUT = "gen_ai.tool.input"
595
+ """
596
+ The input of the tool being used.
597
+ Example: {"location": "Paris"}
598
+ """
599
+
600
+ GEN_AI_TOOL_NAME = "gen_ai.tool.name"
601
+ """
602
+ The name of the tool being used.
603
+ Example: "web_search"
604
+ """
605
+
606
+ GEN_AI_TOOL_OUTPUT = "gen_ai.tool.output"
607
+ """
608
+ The output of the tool being used.
609
+ Example: "rainy, 57°F"
610
+ """
611
+
612
+ GEN_AI_TOOL_TYPE = "gen_ai.tool.type"
613
+ """
614
+ The type of tool being used.
615
+ Example: "function"
616
+ """
617
+
618
+ GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens"
619
+ """
620
+ The number of tokens in the input.
621
+ Example: 150
622
+ """
623
+
624
+ GEN_AI_USAGE_INPUT_TOKENS_CACHED = "gen_ai.usage.input_tokens.cached"
625
+ """
626
+ The number of cached tokens in the input.
627
+ Example: 50
628
+ """
629
+
630
+ GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens"
631
+ """
632
+ The number of tokens in the output.
633
+ Example: 250
634
+ """
635
+
636
+ GEN_AI_USAGE_OUTPUT_TOKENS_REASONING = "gen_ai.usage.output_tokens.reasoning"
637
+ """
638
+ The number of tokens used for reasoning in the output.
639
+ Example: 75
640
+ """
641
+
642
+ GEN_AI_USAGE_TOTAL_TOKENS = "gen_ai.usage.total_tokens"
643
+ """
644
+ The total number of tokens used (input + output).
645
+ Example: 400
646
+ """
647
+
648
+ GEN_AI_USER_MESSAGE = "gen_ai.user.message"
649
+ """
650
+ The user message passed to the model.
651
+ Example: "What's the weather in Paris?"
652
+ """
653
+
654
+ HTTP_FRAGMENT = "http.fragment"
655
+ """
656
+ The Fragments present in the URL.
657
+ Example: #foo=bar
658
+ """
659
+
660
+ HTTP_METHOD = "http.method"
661
+ """
662
+ The HTTP method used.
663
+ Example: GET
664
+ """
665
+
666
+ HTTP_QUERY = "http.query"
667
+ """
668
+ The Query string present in the URL.
669
+ Example: ?foo=bar&bar=baz
670
+ """
671
+
672
+ HTTP_STATUS_CODE = "http.response.status_code"
673
+ """
674
+ The HTTP status code as an integer.
675
+ Example: 418
676
+ """
677
+
678
+ MESSAGING_DESTINATION_NAME = "messaging.destination.name"
679
+ """
680
+ The destination name where the message is being consumed from,
681
+ e.g. the queue name or topic.
682
+ """
683
+
684
+ MESSAGING_MESSAGE_ID = "messaging.message.id"
685
+ """
686
+ The message's identifier.
687
+ """
688
+
689
+ MESSAGING_MESSAGE_RECEIVE_LATENCY = "messaging.message.receive.latency"
690
+ """
691
+ The latency between when the task was enqueued and when it was started to be processed.
692
+ """
693
+
694
+ MESSAGING_MESSAGE_RETRY_COUNT = "messaging.message.retry.count"
695
+ """
696
+ Number of retries/attempts to process a message.
697
+ """
698
+
699
+ MESSAGING_SYSTEM = "messaging.system"
700
+ """
701
+ The messaging system's name, e.g. `kafka`, `aws_sqs`
702
+ """
703
+
704
+ NETWORK_PEER_ADDRESS = "network.peer.address"
705
+ """
706
+ Peer address of the network connection - IP address or Unix domain socket name.
707
+ Example: 10.1.2.80, /tmp/my.sock, localhost
708
+ """
709
+
710
+ NETWORK_PEER_PORT = "network.peer.port"
711
+ """
712
+ Peer port number of the network connection.
713
+ Example: 6379
714
+ """
715
+
716
+ NETWORK_TRANSPORT = "network.transport"
717
+ """
718
+ The transport protocol used for the network connection.
719
+ Example: "tcp", "udp", "unix"
720
+ """
721
+
722
+ PROFILER_ID = "profiler_id"
723
+ """
724
+ Label identifying the profiler id that the span occurred in. This should be a string.
725
+ Example: "5249fbada8d5416482c2f6e47e337372"
726
+ """
727
+
728
+ SERVER_ADDRESS = "server.address"
729
+ """
730
+ Name of the database host.
731
+ Example: example.com
732
+ """
733
+
734
+ SERVER_PORT = "server.port"
735
+ """
736
+ Logical server port number
737
+ Example: 80; 8080; 443
738
+ """
739
+
740
+ SERVER_SOCKET_ADDRESS = "server.socket.address"
741
+ """
742
+ Physical server IP address or Unix socket address.
743
+ Example: 10.5.3.2
744
+ """
745
+
746
+ SERVER_SOCKET_PORT = "server.socket.port"
747
+ """
748
+ Physical server port.
749
+ Recommended: If different than server.port.
750
+ Example: 16456
751
+ """
752
+
753
+ THREAD_ID = "thread.id"
754
+ """
755
+ Identifier of a thread from where the span originated. This should be a string.
756
+ Example: "7972576320"
757
+ """
758
+
759
+ THREAD_NAME = "thread.name"
760
+ """
761
+ Label identifying a thread from where the span originated. This should be a string.
762
+ Example: "MainThread"
763
+ """
764
+
765
+ MCP_TOOL_NAME = "mcp.tool.name"
766
+ """
767
+ The name of the MCP tool being called.
768
+ Example: "get_weather"
769
+ """
770
+
771
+ MCP_PROMPT_NAME = "mcp.prompt.name"
772
+ """
773
+ The name of the MCP prompt being retrieved.
774
+ Example: "code_review"
775
+ """
776
+
777
+ MCP_RESOURCE_URI = "mcp.resource.uri"
778
+ """
779
+ The URI of the MCP resource being accessed.
780
+ Example: "file:///path/to/resource"
781
+ """
782
+
783
+ MCP_METHOD_NAME = "mcp.method.name"
784
+ """
785
+ The MCP protocol method name being called.
786
+ Example: "tools/call", "prompts/get", "resources/read"
787
+ """
788
+
789
+ MCP_REQUEST_ID = "mcp.request.id"
790
+ """
791
+ The unique identifier for the MCP request.
792
+ Example: "req_123abc"
793
+ """
794
+
795
+ MCP_TOOL_RESULT_CONTENT = "mcp.tool.result.content"
796
+ """
797
+ The result/output content from an MCP tool execution.
798
+ Example: "The weather is sunny"
799
+ """
800
+
801
+ MCP_TOOL_RESULT_CONTENT_COUNT = "mcp.tool.result.content_count"
802
+ """
803
+ The number of items/keys in the MCP tool result.
804
+ Example: 5
805
+ """
806
+
807
+ MCP_TOOL_RESULT_IS_ERROR = "mcp.tool.result.is_error"
808
+ """
809
+ Whether the MCP tool execution resulted in an error.
810
+ Example: True
811
+ """
812
+
813
+ MCP_PROMPT_RESULT_MESSAGE_CONTENT = "mcp.prompt.result.message_content"
814
+ """
815
+ The message content from an MCP prompt retrieval.
816
+ Example: "Review the following code..."
817
+ """
818
+
819
+ MCP_PROMPT_RESULT_MESSAGE_ROLE = "mcp.prompt.result.message_role"
820
+ """
821
+ The role of the message in an MCP prompt retrieval (only set for single-message prompts).
822
+ Example: "user", "assistant", "system"
823
+ """
824
+
825
+ MCP_PROMPT_RESULT_MESSAGE_COUNT = "mcp.prompt.result.message_count"
826
+ """
827
+ The number of messages in an MCP prompt result.
828
+ Example: 1, 3
829
+ """
830
+
831
+ MCP_RESOURCE_PROTOCOL = "mcp.resource.protocol"
832
+ """
833
+ The protocol/scheme of the MCP resource URI.
834
+ Example: "file", "http", "https"
835
+ """
836
+
837
+ MCP_TRANSPORT = "mcp.transport"
838
+ """
839
+ The transport method used for MCP communication.
840
+ Example: "http", "sse", "stdio"
841
+ """
842
+
843
+ MCP_SESSION_ID = "mcp.session.id"
844
+ """
845
+ The session identifier for the MCP connection.
846
+ Example: "a1b2c3d4e5f6"
847
+ """
848
+
849
+
850
+ class SPANSTATUS:
851
+ """
852
+ The status of a Sentry span.
853
+
854
+ See: https://develop.sentry.dev/sdk/event-payloads/contexts/#trace-context
855
+ """
856
+
857
+ ABORTED = "aborted"
858
+ ALREADY_EXISTS = "already_exists"
859
+ CANCELLED = "cancelled"
860
+ DATA_LOSS = "data_loss"
861
+ DEADLINE_EXCEEDED = "deadline_exceeded"
862
+ ERROR = "error" # OTel status code: https://opentelemetry.io/docs/concepts/signals/traces/#span-status
863
+ FAILED_PRECONDITION = "failed_precondition"
864
+ INTERNAL_ERROR = "internal_error"
865
+ INVALID_ARGUMENT = "invalid_argument"
866
+ NOT_FOUND = "not_found"
867
+ OK = "ok" # HTTP 200 and OTel status code: https://opentelemetry.io/docs/concepts/signals/traces/#span-status
868
+ OUT_OF_RANGE = "out_of_range"
869
+ PERMISSION_DENIED = "permission_denied"
870
+ RESOURCE_EXHAUSTED = "resource_exhausted"
871
+ UNAUTHENTICATED = "unauthenticated"
872
+ UNAVAILABLE = "unavailable"
873
+ UNIMPLEMENTED = "unimplemented"
874
+ UNKNOWN_ERROR = "unknown_error"
875
+ UNSET = "unset" # OTel status code: https://opentelemetry.io/docs/concepts/signals/traces/#span-status
876
+
877
+
878
+ class OP:
879
+ ANTHROPIC_MESSAGES_CREATE = "ai.messages.create.anthropic"
880
+ CACHE_GET = "cache.get"
881
+ CACHE_PUT = "cache.put"
882
+ COHERE_CHAT_COMPLETIONS_CREATE = "ai.chat_completions.create.cohere"
883
+ COHERE_EMBEDDINGS_CREATE = "ai.embeddings.create.cohere"
884
+ DB = "db"
885
+ DB_REDIS = "db.redis"
886
+ EVENT_DJANGO = "event.django"
887
+ FUNCTION = "function"
888
+ FUNCTION_AWS = "function.aws"
889
+ FUNCTION_GCP = "function.gcp"
890
+ GEN_AI_CHAT = "gen_ai.chat"
891
+ GEN_AI_CREATE_AGENT = "gen_ai.create_agent"
892
+ GEN_AI_EMBEDDINGS = "gen_ai.embeddings"
893
+ GEN_AI_EXECUTE_TOOL = "gen_ai.execute_tool"
894
+ GEN_AI_GENERATE_TEXT = "gen_ai.generate_text"
895
+ GEN_AI_HANDOFF = "gen_ai.handoff"
896
+ GEN_AI_PIPELINE = "gen_ai.pipeline"
897
+ GEN_AI_INVOKE_AGENT = "gen_ai.invoke_agent"
898
+ GEN_AI_RESPONSES = "gen_ai.responses"
899
+ GRAPHQL_EXECUTE = "graphql.execute"
900
+ GRAPHQL_MUTATION = "graphql.mutation"
901
+ GRAPHQL_PARSE = "graphql.parse"
902
+ GRAPHQL_RESOLVE = "graphql.resolve"
903
+ GRAPHQL_SUBSCRIPTION = "graphql.subscription"
904
+ GRAPHQL_QUERY = "graphql.query"
905
+ GRAPHQL_VALIDATE = "graphql.validate"
906
+ GRPC_CLIENT = "grpc.client"
907
+ GRPC_SERVER = "grpc.server"
908
+ HTTP_CLIENT = "http.client"
909
+ HTTP_CLIENT_STREAM = "http.client.stream"
910
+ HTTP_SERVER = "http.server"
911
+ MIDDLEWARE_DJANGO = "middleware.django"
912
+ MIDDLEWARE_LITESTAR = "middleware.litestar"
913
+ MIDDLEWARE_LITESTAR_RECEIVE = "middleware.litestar.receive"
914
+ MIDDLEWARE_LITESTAR_SEND = "middleware.litestar.send"
915
+ MIDDLEWARE_STARLETTE = "middleware.starlette"
916
+ MIDDLEWARE_STARLETTE_RECEIVE = "middleware.starlette.receive"
917
+ MIDDLEWARE_STARLETTE_SEND = "middleware.starlette.send"
918
+ MIDDLEWARE_STARLITE = "middleware.starlite"
919
+ MIDDLEWARE_STARLITE_RECEIVE = "middleware.starlite.receive"
920
+ MIDDLEWARE_STARLITE_SEND = "middleware.starlite.send"
921
+ HUGGINGFACE_HUB_CHAT_COMPLETIONS_CREATE = (
922
+ "ai.chat_completions.create.huggingface_hub"
923
+ )
924
+ QUEUE_PROCESS = "queue.process"
925
+ QUEUE_PUBLISH = "queue.publish"
926
+ QUEUE_SUBMIT_ARQ = "queue.submit.arq"
927
+ QUEUE_TASK_ARQ = "queue.task.arq"
928
+ QUEUE_SUBMIT_CELERY = "queue.submit.celery"
929
+ QUEUE_TASK_CELERY = "queue.task.celery"
930
+ QUEUE_TASK_RQ = "queue.task.rq"
931
+ QUEUE_SUBMIT_HUEY = "queue.submit.huey"
932
+ QUEUE_TASK_HUEY = "queue.task.huey"
933
+ QUEUE_SUBMIT_RAY = "queue.submit.ray"
934
+ QUEUE_TASK_RAY = "queue.task.ray"
935
+ QUEUE_TASK_DRAMATIQ = "queue.task.dramatiq"
936
+ SUBPROCESS = "subprocess"
937
+ SUBPROCESS_WAIT = "subprocess.wait"
938
+ SUBPROCESS_COMMUNICATE = "subprocess.communicate"
939
+ TEMPLATE_RENDER = "template.render"
940
+ VIEW_RENDER = "view.render"
941
+ VIEW_RESPONSE_RENDER = "view.response.render"
942
+ WEBSOCKET_SERVER = "websocket.server"
943
+ SOCKET_CONNECTION = "socket.connection"
944
+ SOCKET_DNS = "socket.dns"
945
+ MCP_SERVER = "mcp.server"
946
+
947
+
948
+ # This type exists to trick mypy and PyCharm into thinking `init` and `Client`
949
+ # take these arguments (even though they take opaque **kwargs)
950
+ class ClientConstructor:
951
+ def __init__(
952
+ self,
953
+ dsn=None, # type: Optional[str]
954
+ *,
955
+ max_breadcrumbs=DEFAULT_MAX_BREADCRUMBS, # type: int
956
+ release=None, # type: Optional[str]
957
+ environment=None, # type: Optional[str]
958
+ server_name=None, # type: Optional[str]
959
+ shutdown_timeout=2, # type: float
960
+ integrations=[], # type: Sequence[sentry_sdk.integrations.Integration] # noqa: B006
961
+ in_app_include=[], # type: List[str] # noqa: B006
962
+ in_app_exclude=[], # type: List[str] # noqa: B006
963
+ default_integrations=True, # type: bool
964
+ dist=None, # type: Optional[str]
965
+ transport=None, # type: Optional[Union[sentry_sdk.transport.Transport, Type[sentry_sdk.transport.Transport], Callable[[Event], None]]]
966
+ transport_queue_size=DEFAULT_QUEUE_SIZE, # type: int
967
+ sample_rate=1.0, # type: float
968
+ send_default_pii=None, # type: Optional[bool]
969
+ http_proxy=None, # type: Optional[str]
970
+ https_proxy=None, # type: Optional[str]
971
+ ignore_errors=[], # type: Sequence[Union[type, str]] # noqa: B006
972
+ max_request_body_size="medium", # type: str
973
+ socket_options=None, # type: Optional[List[Tuple[int, int, int | bytes]]]
974
+ keep_alive=None, # type: Optional[bool]
975
+ before_send=None, # type: Optional[EventProcessor]
976
+ before_breadcrumb=None, # type: Optional[BreadcrumbProcessor]
977
+ debug=None, # type: Optional[bool]
978
+ attach_stacktrace=False, # type: bool
979
+ ca_certs=None, # type: Optional[str]
980
+ propagate_traces=True, # type: bool
981
+ traces_sample_rate=None, # type: Optional[float]
982
+ traces_sampler=None, # type: Optional[TracesSampler]
983
+ profiles_sample_rate=None, # type: Optional[float]
984
+ profiles_sampler=None, # type: Optional[TracesSampler]
985
+ profiler_mode=None, # type: Optional[ProfilerMode]
986
+ profile_lifecycle="manual", # type: Literal["manual", "trace"]
987
+ profile_session_sample_rate=None, # type: Optional[float]
988
+ auto_enabling_integrations=True, # type: bool
989
+ disabled_integrations=None, # type: Optional[Sequence[sentry_sdk.integrations.Integration]]
990
+ auto_session_tracking=True, # type: bool
991
+ send_client_reports=True, # type: bool
992
+ _experiments={}, # type: Experiments # noqa: B006
993
+ proxy_headers=None, # type: Optional[Dict[str, str]]
994
+ instrumenter=INSTRUMENTER.SENTRY, # type: Optional[str]
995
+ before_send_transaction=None, # type: Optional[TransactionProcessor]
996
+ project_root=None, # type: Optional[str]
997
+ enable_tracing=None, # type: Optional[bool]
998
+ include_local_variables=True, # type: Optional[bool]
999
+ include_source_context=True, # type: Optional[bool]
1000
+ trace_propagation_targets=[ # noqa: B006
1001
+ MATCH_ALL
1002
+ ], # type: Optional[Sequence[str]]
1003
+ functions_to_trace=[], # type: Sequence[Dict[str, str]] # noqa: B006
1004
+ event_scrubber=None, # type: Optional[sentry_sdk.scrubber.EventScrubber]
1005
+ max_value_length=DEFAULT_MAX_VALUE_LENGTH, # type: int
1006
+ enable_backpressure_handling=True, # type: bool
1007
+ error_sampler=None, # type: Optional[Callable[[Event, Hint], Union[float, bool]]]
1008
+ enable_db_query_source=True, # type: bool
1009
+ db_query_source_threshold_ms=100, # type: int
1010
+ enable_http_request_source=True, # type: bool
1011
+ http_request_source_threshold_ms=100, # type: int
1012
+ spotlight=None, # type: Optional[Union[bool, str]]
1013
+ cert_file=None, # type: Optional[str]
1014
+ key_file=None, # type: Optional[str]
1015
+ custom_repr=None, # type: Optional[Callable[..., Optional[str]]]
1016
+ add_full_stack=DEFAULT_ADD_FULL_STACK, # type: bool
1017
+ max_stack_frames=DEFAULT_MAX_STACK_FRAMES, # type: Optional[int]
1018
+ enable_logs=False, # type: bool
1019
+ before_send_log=None, # type: Optional[Callable[[Log, Hint], Optional[Log]]]
1020
+ trace_ignore_status_codes=frozenset(), # type: AbstractSet[int]
1021
+ enable_metrics=True, # type: bool
1022
+ before_send_metric=None, # type: Optional[Callable[[Metric, Hint], Optional[Metric]]]
1023
+ ):
1024
+ # type: (...) -> None
1025
+ """Initialize the Sentry SDK with the given parameters. All parameters described here can be used in a call to `sentry_sdk.init()`.
1026
+
1027
+ :param dsn: The DSN tells the SDK where to send the events.
1028
+
1029
+ If this option is not set, the SDK will just not send any data.
1030
+
1031
+ The `dsn` config option takes precedence over the environment variable.
1032
+
1033
+ Learn more about `DSN utilization <https://docs.sentry.io/product/sentry-basics/dsn-explainer/#dsn-utilization>`_.
1034
+
1035
+ :param debug: Turns debug mode on or off.
1036
+
1037
+ When `True`, the SDK will attempt to print out debugging information. This can be useful if something goes
1038
+ wrong with event sending.
1039
+
1040
+ The default is always `False`. It's generally not recommended to turn it on in production because of the
1041
+ increase in log output.
1042
+
1043
+ The `debug` config option takes precedence over the environment variable.
1044
+
1045
+ :param release: Sets the release.
1046
+
1047
+ If not set, the SDK will try to automatically configure a release out of the box but it's a better idea to
1048
+ manually set it to guarantee that the release is in sync with your deploy integrations.
1049
+
1050
+ Release names are strings, but some formats are detected by Sentry and might be rendered differently.
1051
+
1052
+ See `the releases documentation <https://docs.sentry.io/platforms/python/configuration/releases/>`_ to learn how the SDK tries to
1053
+ automatically configure a release.
1054
+
1055
+ The `release` config option takes precedence over the environment variable.
1056
+
1057
+ Learn more about how to send release data so Sentry can tell you about regressions between releases and
1058
+ identify the potential source in `the product documentation <https://docs.sentry.io/product/releases/>`_.
1059
+
1060
+ :param environment: Sets the environment. This string is freeform and set to `production` by default.
1061
+
1062
+ A release can be associated with more than one environment to separate them in the UI (think `staging` vs
1063
+ `production` or similar).
1064
+
1065
+ The `environment` config option takes precedence over the environment variable.
1066
+
1067
+ :param dist: The distribution of the application.
1068
+
1069
+ Distributions are used to disambiguate build or deployment variants of the same release of an application.
1070
+
1071
+ The dist can be for example a build number.
1072
+
1073
+ :param sample_rate: Configures the sample rate for error events, in the range of `0.0` to `1.0`.
1074
+
1075
+ The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of
1076
+ error events will be sent.
1077
+
1078
+ Events are picked randomly.
1079
+
1080
+ :param error_sampler: Dynamically configures the sample rate for error events on a per-event basis.
1081
+
1082
+ This configuration option accepts a function, which takes two parameters (the `event` and the `hint`), and
1083
+ which returns a boolean (indicating whether the event should be sent to Sentry) or a floating-point number
1084
+ between `0.0` and `1.0`, inclusive.
1085
+
1086
+ The number indicates the probability the event is sent to Sentry; the SDK will randomly decide whether to
1087
+ send the event with the given probability.
1088
+
1089
+ If this configuration option is specified, the `sample_rate` option is ignored.
1090
+
1091
+ :param ignore_errors: A list of exception class names that shouldn't be sent to Sentry.
1092
+
1093
+ Errors that are an instance of these exceptions or a subclass of them, will be filtered out before they're
1094
+ sent to Sentry.
1095
+
1096
+ By default, all errors are sent.
1097
+
1098
+ :param max_breadcrumbs: This variable controls the total amount of breadcrumbs that should be captured.
1099
+
1100
+ This defaults to `100`, but you can set this to any number.
1101
+
1102
+ However, you should be aware that Sentry has a `maximum payload size <https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits>`_
1103
+ and any events exceeding that payload size will be dropped.
1104
+
1105
+ :param attach_stacktrace: When enabled, stack traces are automatically attached to all messages logged.
1106
+
1107
+ Stack traces are always attached to exceptions; however, when this option is set, stack traces are also
1108
+ sent with messages.
1109
+
1110
+ This option means that stack traces appear next to all log messages.
1111
+
1112
+ Grouping in Sentry is different for events with stack traces and without. As a result, you will get new
1113
+ groups as you enable or disable this flag for certain events.
1114
+
1115
+ :param send_default_pii: If this flag is enabled, `certain personally identifiable information (PII)
1116
+ <https://docs.sentry.io/platforms/python/data-management/data-collected/>`_ is added by active integrations.
1117
+
1118
+ If you enable this option, be sure to manually remove what you don't want to send using our features for
1119
+ managing `Sensitive Data <https://docs.sentry.io/data-management/sensitive-data/>`_.
1120
+
1121
+ :param event_scrubber: Scrubs the event payload for sensitive information such as cookies, sessions, and
1122
+ passwords from a `denylist`.
1123
+
1124
+ It can additionally be used to scrub from another `pii_denylist` if `send_default_pii` is disabled.
1125
+
1126
+ See how to `configure the scrubber here <https://docs.sentry.io/data-management/sensitive-data/#event-scrubber>`_.
1127
+
1128
+ :param include_source_context: When enabled, source context will be included in events sent to Sentry.
1129
+
1130
+ This source context includes the five lines of code above and below the line of code where an error
1131
+ happened.
1132
+
1133
+ :param include_local_variables: When enabled, the SDK will capture a snapshot of local variables to send with
1134
+ the event to help with debugging.
1135
+
1136
+ :param add_full_stack: When capturing errors, Sentry stack traces typically only include frames that start the
1137
+ moment an error occurs.
1138
+
1139
+ But if the `add_full_stack` option is enabled (set to `True`), all frames from the start of execution will
1140
+ be included in the stack trace sent to Sentry.
1141
+
1142
+ :param max_stack_frames: This option limits the number of stack frames that will be captured when
1143
+ `add_full_stack` is enabled.
1144
+
1145
+ :param server_name: This option can be used to supply a server name.
1146
+
1147
+ When provided, the name of the server is sent along and persisted in the event.
1148
+
1149
+ For many integrations, the server name actually corresponds to the device hostname, even in situations
1150
+ where the machine is not actually a server.
1151
+
1152
+ :param project_root: The full path to the root directory of your application.
1153
+
1154
+ The `project_root` is used to mark frames in a stack trace either as being in your application or outside
1155
+ of the application.
1156
+
1157
+ :param in_app_include: A list of string prefixes of module names that belong to the app.
1158
+
1159
+ This option takes precedence over `in_app_exclude`.
1160
+
1161
+ Sentry differentiates stack frames that are directly related to your application ("in application") from
1162
+ stack frames that come from other packages such as the standard library, frameworks, or other dependencies.
1163
+
1164
+ The application package is automatically marked as `inApp`.
1165
+
1166
+ The difference is visible in [sentry.io](https://sentry.io), where only the "in application" frames are
1167
+ displayed by default.
1168
+
1169
+ :param in_app_exclude: A list of string prefixes of module names that do not belong to the app, but rather to
1170
+ third-party packages.
1171
+
1172
+ Modules considered not part of the app will be hidden from stack traces by default.
1173
+
1174
+ This option can be overridden using `in_app_include`.
1175
+
1176
+ :param max_request_body_size: This parameter controls whether integrations should capture HTTP request bodies.
1177
+ It can be set to one of the following values:
1178
+
1179
+ - `never`: Request bodies are never sent.
1180
+ - `small`: Only small request bodies will be captured. The cutoff for small depends on the SDK (typically
1181
+ 4KB).
1182
+ - `medium`: Medium and small requests will be captured (typically 10KB).
1183
+ - `always`: The SDK will always capture the request body as long as Sentry can make sense of it.
1184
+
1185
+ Please note that the Sentry server [limits HTTP request body size](https://develop.sentry.dev/sdk/
1186
+ expected-features/data-handling/#variable-size). The server always enforces its size limit, regardless of
1187
+ how you configure this option.
1188
+
1189
+ :param max_value_length: The number of characters after which the values containing text in the event payload
1190
+ will be truncated.
1191
+
1192
+ WARNING: If the value you set for this is exceptionally large, the event may exceed 1 MiB and will be
1193
+ dropped by Sentry.
1194
+
1195
+ :param ca_certs: A path to an alternative CA bundle file in PEM-format.
1196
+
1197
+ :param send_client_reports: Set this boolean to `False` to disable sending of client reports.
1198
+
1199
+ Client reports allow the client to send status reports about itself to Sentry, such as information about
1200
+ events that were dropped before being sent.
1201
+
1202
+ :param integrations: List of integrations to enable in addition to `auto-enabling integrations (overview)
1203
+ <https://docs.sentry.io/platforms/python/integrations>`_.
1204
+
1205
+ This setting can be used to override the default config options for a specific auto-enabling integration
1206
+ or to add an integration that is not auto-enabled.
1207
+
1208
+ :param disabled_integrations: List of integrations that will be disabled.
1209
+
1210
+ This setting can be used to explicitly turn off specific `auto-enabling integrations (list)
1211
+ <https://docs.sentry.io/platforms/python/integrations/#available-integrations>`_ or
1212
+ `default <https://docs.sentry.io/platforms/python/integrations/default-integrations/>`_ integrations.
1213
+
1214
+ :param auto_enabling_integrations: Configures whether `auto-enabling integrations (configuration)
1215
+ <https://docs.sentry.io/platforms/python/integrations/#available-integrations>`_ should be enabled.
1216
+
1217
+ When set to `False`, no auto-enabling integrations will be enabled by default, even if the corresponding
1218
+ framework/library is detected.
1219
+
1220
+ :param default_integrations: Configures whether `default integrations
1221
+ <https://docs.sentry.io/platforms/python/integrations/default-integrations/>`_ should be enabled.
1222
+
1223
+ Setting `default_integrations` to `False` disables all default integrations **as well as all auto-enabling
1224
+ integrations**, unless they are specifically added in the `integrations` option, described above.
1225
+
1226
+ :param before_send: This function is called with an SDK-specific message or error event object, and can return
1227
+ a modified event object, or `null` to skip reporting the event.
1228
+
1229
+ This can be used, for instance, for manual PII stripping before sending.
1230
+
1231
+ By the time `before_send` is executed, all scope data has already been applied to the event. Further
1232
+ modification of the scope won't have any effect.
1233
+
1234
+ :param before_send_transaction: This function is called with an SDK-specific transaction event object, and can
1235
+ return a modified transaction event object, or `null` to skip reporting the event.
1236
+
1237
+ One way this might be used is for manual PII stripping before sending.
1238
+
1239
+ :param before_breadcrumb: This function is called with an SDK-specific breadcrumb object before the breadcrumb
1240
+ is added to the scope.
1241
+
1242
+ When nothing is returned from the function, the breadcrumb is dropped.
1243
+
1244
+ To pass the breadcrumb through, return the first argument, which contains the breadcrumb object.
1245
+
1246
+ The callback typically gets a second argument (called a "hint") which contains the original object from
1247
+ which the breadcrumb was created to further customize what the breadcrumb should look like.
1248
+
1249
+ :param transport: Switches out the transport used to send events.
1250
+
1251
+ How this works depends on the SDK. It can, for instance, be used to capture events for unit-testing or to
1252
+ send it through some more complex setup that requires proxy authentication.
1253
+
1254
+ :param transport_queue_size: The maximum number of events that will be queued before the transport is forced to
1255
+ flush.
1256
+
1257
+ :param http_proxy: When set, a proxy can be configured that should be used for outbound requests.
1258
+
1259
+ This is also used for HTTPS requests unless a separate `https_proxy` is configured. However, not all SDKs
1260
+ support a separate HTTPS proxy.
1261
+
1262
+ SDKs will attempt to default to the system-wide configured proxy, if possible. For instance, on Unix
1263
+ systems, the `http_proxy` environment variable will be picked up.
1264
+
1265
+ :param https_proxy: Configures a separate proxy for outgoing HTTPS requests.
1266
+
1267
+ This value might not be supported by all SDKs. When not supported the `http-proxy` value is also used for
1268
+ HTTPS requests at all times.
1269
+
1270
+ :param proxy_headers: A dict containing additional proxy headers (usually for authentication) to be forwarded
1271
+ to `urllib3`'s `ProxyManager <https://urllib3.readthedocs.io/en/1.24.3/reference/index.html#urllib3.poolmanager.ProxyManager>`_.
1272
+
1273
+ :param shutdown_timeout: Controls how many seconds to wait before shutting down.
1274
+
1275
+ Sentry SDKs send events from a background queue. This queue is given a certain amount to drain pending
1276
+ events. The default is SDK specific but typically around two seconds.
1277
+
1278
+ Setting this value too low may cause problems for sending events from command line applications.
1279
+
1280
+ Setting the value too high will cause the application to block for a long time for users experiencing
1281
+ network connectivity problems.
1282
+
1283
+ :param keep_alive: Determines whether to keep the connection alive between requests.
1284
+
1285
+ This can be useful in environments where you encounter frequent network issues such as connection resets.
1286
+
1287
+ :param cert_file: Path to the client certificate to use.
1288
+
1289
+ If set, supersedes the `CLIENT_CERT_FILE` environment variable.
1290
+
1291
+ :param key_file: Path to the key file to use.
1292
+
1293
+ If set, supersedes the `CLIENT_KEY_FILE` environment variable.
1294
+
1295
+ :param socket_options: An optional list of socket options to use.
1296
+
1297
+ These provide fine-grained, low-level control over the way the SDK connects to Sentry.
1298
+
1299
+ If provided, the options will override the default `urllib3` `socket options
1300
+ <https://urllib3.readthedocs.io/en/stable/reference/urllib3.connection.html#urllib3.connection.HTTPConnection>`_.
1301
+
1302
+ :param traces_sample_rate: A number between `0` and `1`, controlling the percentage chance a given transaction
1303
+ will be sent to Sentry.
1304
+
1305
+ (`0` represents 0% while `1` represents 100%.) Applies equally to all transactions created in the app.
1306
+
1307
+ Either this or `traces_sampler` must be defined to enable tracing.
1308
+
1309
+ If `traces_sample_rate` is `0`, this means that no new traces will be created. However, if you have
1310
+ another service (for example a JS frontend) that makes requests to your service that include trace
1311
+ information, those traces will be continued and thus transactions will be sent to Sentry.
1312
+
1313
+ If you want to disable all tracing you need to set `traces_sample_rate=None`. In this case, no new traces
1314
+ will be started and no incoming traces will be continued.
1315
+
1316
+ :param traces_sampler: A function responsible for determining the percentage chance a given transaction will be
1317
+ sent to Sentry.
1318
+
1319
+ It will automatically be passed information about the transaction and the context in which it's being
1320
+ created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being
1321
+ sent).
1322
+
1323
+ Can also be used for filtering transactions, by returning `0` for those that are unwanted.
1324
+
1325
+ Either this or `traces_sample_rate` must be defined to enable tracing.
1326
+
1327
+ :param trace_propagation_targets: An optional property that controls which downstream services receive tracing
1328
+ data, in the form of a `sentry-trace` and a `baggage` header attached to any outgoing HTTP requests.
1329
+
1330
+ The option may contain a list of strings or regex against which the URLs of outgoing requests are matched.
1331
+
1332
+ If one of the entries in the list matches the URL of an outgoing request, trace data will be attached to
1333
+ that request.
1334
+
1335
+ String entries do not have to be full matches, meaning the URL of a request is matched when it _contains_
1336
+ a string provided through the option.
1337
+
1338
+ If `trace_propagation_targets` is not provided, trace data is attached to every outgoing request from the
1339
+ instrumented client.
1340
+
1341
+ :param functions_to_trace: An optional list of functions that should be set up for tracing.
1342
+
1343
+ For each function in the list, a span will be created when the function is executed.
1344
+
1345
+ Functions in the list are represented as strings containing the fully qualified name of the function.
1346
+
1347
+ This is a convenient option, making it possible to have one central place for configuring what functions
1348
+ to trace, instead of having custom instrumentation scattered all over your code base.
1349
+
1350
+ To learn more, see the `Custom Instrumentation <https://docs.sentry.io/platforms/python/tracing/instrumentation/custom-instrumentation/#define-span-creation-in-a-central-place>`_ documentation.
1351
+
1352
+ :param enable_backpressure_handling: When enabled, a new monitor thread will be spawned to perform health
1353
+ checks on the SDK.
1354
+
1355
+ If the system is unhealthy, the SDK will keep halving the `traces_sample_rate` set by you in 10 second
1356
+ intervals until recovery.
1357
+
1358
+ This down sampling helps ensure that the system stays stable and reduces SDK overhead under high load.
1359
+
1360
+ This option is enabled by default.
1361
+
1362
+ :param enable_db_query_source: When enabled, the source location will be added to database queries.
1363
+
1364
+ :param db_query_source_threshold_ms: The threshold in milliseconds for adding the source location to database
1365
+ queries.
1366
+
1367
+ The query location will be added to the query for queries slower than the specified threshold.
1368
+
1369
+ :param enable_http_request_source: When enabled, the source location will be added to outgoing HTTP requests.
1370
+
1371
+ :param http_request_source_threshold_ms: The threshold in milliseconds for adding the source location to an
1372
+ outgoing HTTP request.
1373
+
1374
+ The request location will be added to the request for requests slower than the specified threshold.
1375
+
1376
+ :param custom_repr: A custom `repr <https://docs.python.org/3/library/functions.html#repr>`_ function to run
1377
+ while serializing an object.
1378
+
1379
+ Use this to control how your custom objects and classes are visible in Sentry.
1380
+
1381
+ Return a string for that repr value to be used or `None` to continue serializing how Sentry would have
1382
+ done it anyway.
1383
+
1384
+ :param profiles_sample_rate: A number between `0` and `1`, controlling the percentage chance a given sampled
1385
+ transaction will be profiled.
1386
+
1387
+ (`0` represents 0% while `1` represents 100%.) Applies equally to all transactions created in the app.
1388
+
1389
+ This is relative to the tracing sample rate - e.g. `0.5` means 50% of sampled transactions will be
1390
+ profiled.
1391
+
1392
+ :param profiles_sampler:
1393
+
1394
+ :param profiler_mode:
1395
+
1396
+ :param profile_lifecycle:
1397
+
1398
+ :param profile_session_sample_rate:
1399
+
1400
+ :param enable_tracing:
1401
+
1402
+ :param propagate_traces:
1403
+
1404
+ :param auto_session_tracking:
1405
+
1406
+ :param spotlight:
1407
+
1408
+ :param instrumenter:
1409
+
1410
+ :param enable_logs: Set `enable_logs` to True to enable the SDK to emit
1411
+ Sentry logs. Defaults to False.
1412
+
1413
+ :param before_send_log: An optional function to modify or filter out logs
1414
+ before they're sent to Sentry. Any modifications to the log in this
1415
+ function will be retained. If the function returns None, the log will
1416
+ not be sent to Sentry.
1417
+
1418
+ :param trace_ignore_status_codes: An optional property that disables tracing for
1419
+ HTTP requests with certain status codes.
1420
+
1421
+ Requests are not traced if the status code is contained in the provided set.
1422
+
1423
+ If `trace_ignore_status_codes` is not provided, requests with any status code
1424
+ may be traced.
1425
+
1426
+ :param _experiments:
1427
+ """
1428
+ pass
1429
+
1430
+
1431
+ def _get_default_options():
1432
+ # type: () -> dict[str, Any]
1433
+ import inspect
1434
+
1435
+ a = inspect.getfullargspec(ClientConstructor.__init__)
1436
+ defaults = a.defaults or ()
1437
+ kwonlydefaults = a.kwonlydefaults or {}
1438
+
1439
+ return dict(
1440
+ itertools.chain(
1441
+ zip(a.args[-len(defaults) :], defaults),
1442
+ kwonlydefaults.items(),
1443
+ )
1444
+ )
1445
+
1446
+
1447
+ DEFAULT_OPTIONS = _get_default_options()
1448
+ del _get_default_options
1449
+
44
1450
 
45
- VERSION = "0.7.5"
46
- DEFAULT_SERVER_NAME = socket.gethostname() if hasattr(socket, "gethostname") else None
47
- DEFAULT_OPTIONS = {
48
- "dsn": None,
49
- "with_locals": True,
50
- "max_breadcrumbs": 100,
51
- "release": None,
52
- "environment": None,
53
- "server_name": DEFAULT_SERVER_NAME,
54
- "shutdown_timeout": 2.0,
55
- "integrations": [],
56
- "in_app_include": [],
57
- "in_app_exclude": [],
58
- "default_integrations": True,
59
- "dist": None,
60
- "transport": None,
61
- "sample_rate": 1.0,
62
- "send_default_pii": False,
63
- "http_proxy": None,
64
- "https_proxy": None,
65
- "ignore_errors": [],
66
- "request_bodies": "medium",
67
- "before_send": None,
68
- "before_breadcrumb": None,
69
- "debug": False,
70
- "attach_stacktrace": False,
71
- "ca_certs": None,
72
- }
73
-
74
-
75
- SDK_INFO = {
76
- "name": "sentry.python",
77
- "version": VERSION,
78
- "packages": [{"name": "pypi:sentry-sdk", "version": VERSION}],
79
- }
1451
+ VERSION = "2.46.0"