Commit dee16a1
Support Python SDK 3.0.0 (#92011)
Update the codebase so it works with `Sentry Python SDK 3.0.0 alpha`.
Sentry SDK 3.0.0 has some backwards incompatibilities and uses
Opentelementry under the hood to create spans.
### What this PR does:
- replace `sentry_sdk.start_transaction()` with
`sentry_sdk.start_span()`
- replace `span.set_data()` with `span.set_attribute()`
- replace `scope.transaction` with `scope.root_span`
- replace `Span.containing_transaction` with `Span.root_span`
- replace `custom_sampling_context` with `attributes` parameter
- replace `sentry_sdk.scope.get_*_scope()` with
`sentry_sdk.get_*_scope()`
- replace one `scope.add_attachment()` with
`sentry_sdk.add_attachment()`
- change one `continue_trace()` to the new context manager.
- update `traces_sampler` to use new `sampling_context` format
- added a few tests
See also the migration guide:
https://docs.sentry.io/platforms/python/migration/2.x-to-3.x
---
### Related, but split out into separate PRs:
- make sure `traces_sampler` works the same as before (check for
`sample_rate`): #93011
- make **all** `get_isolation_scope` calls use the top-level API.
Currently, some calls where we `from sentry_sdk import Scope` then call
`Scope.get_isolation_scope` still need to be converted to the top-level
API: #93307
- check `event["measurements"]` places if those can be removed (because
SDK does not support measurements anymore):
#92718
- change set_span_data() to set_span_attribute() but check for value NOT
be a dict: #92946
- replace `with sentry_sdk.init(dsn=...)` with `with
sentry_sdk.new_scope() as scope:
scope.set_client(sentry_sdk.Client(dsn=...))` in
`src/sentry/runner/main.py`: #92944
- remove `propagate_hub=True` from `ThreadingIntegration`: #93016
- remove minimetrics from the sentry codebase, because the metrics
product was never released: #93595
- https://github.com/getsentry/getsentry/pull/17553
- getsentry/devenv#194
- getsentry/devservices#277
- getsentry/pytest-sentry#39
- getsentry/sentry-docs#13939
---------
Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
Co-authored-by: Daniel Szoke <daniel.szoke@sentry.io>
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
Co-authored-by: Ivana Kellyer <ivana.kellyerova@sentry.io>
Co-authored-by: Neel Shah <neel.shah@sentry.io>1 parent 5555dd5 commit dee16a1
File tree
82 files changed
+285
-206
lines changed- src/sentry
- api
- bases
- endpoints
- serializers
- models
- auth
- cache
- consumers
- debug_files
- demo_mode
- dynamic_sampling/rules/helpers
- features
- hybridcloud/models
- ingest
- consumer
- transaction_clusterer
- integrations/web
- issues
- endpoints
- models
- monitors/consumers
- performance_issues
- processing/backpressure
- relay/config
- remote_subscriptions/consumers
- replays
- consumers
- usecases/ingest
- runner
- commands
- scim/endpoints
- search
- events/builder
- snuba
- sentry_apps/api/endpoints
- sentry_metrics/consumers/indexer
- snuba
- metrics/fields
- query_subscriptions
- spans/consumers/process
- stacktraces
- tagstore/snuba
- tasks
- taskworker
- tempest
- utils
- tests
- relay_integration
- sentry
- event_manager
- ingest/ingest_consumer
- performance_issues
- experiments
- sentry_apps/api
- bases
- endpoints
- taskworker
- utils
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
82 files changed
+285
-206
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
118 | 123 | | |
119 | 124 | | |
120 | 125 | | |
| |||
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
155 | | - | |
| 160 | + | |
156 | 161 | | |
157 | 162 | | |
158 | 163 | | |
| |||
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
194 | | - | |
| 199 | + | |
195 | 200 | | |
196 | 201 | | |
197 | 202 | | |
| |||
247 | 252 | | |
248 | 253 | | |
249 | 254 | | |
| 255 | + | |
250 | 256 | | |
251 | 257 | | |
252 | 258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
85 | 90 | | |
86 | 91 | | |
87 | 92 | | |
| |||
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
131 | | - | |
| 136 | + | |
132 | 137 | | |
133 | 138 | | |
134 | 139 | | |
| |||
154 | 159 | | |
155 | 160 | | |
156 | 161 | | |
| 162 | + | |
157 | 163 | | |
| 164 | + | |
158 | 165 | | |
159 | 166 | | |
160 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
449 | 451 | | |
450 | 452 | | |
451 | 453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
411 | | - | |
| 411 | + | |
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
| 437 | + | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
| 394 | + | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | | - | |
421 | | - | |
| 420 | + | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
0 commit comments