Skip to content

Conversation

antonpirker
Copy link
Member

@antonpirker antonpirker commented May 20, 2025

The behavior stays the same. The deprecated enable_tracing=True sets traces_sample_rate=1.0 internally.

See https://docs.sentry.io/platforms/python/migration/2.x-to-3.x#configuration

Copy link

codecov bot commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.86%. Comparing base (a3c2613) to head (ed797b9).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #277   +/-   ##
=======================================
  Coverage   94.86%   94.86%           
=======================================
  Files          27       27           
  Lines        2238     2238           
=======================================
  Hits         2123     2123           
  Misses        115      115           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@antonpirker antonpirker marked this pull request as ready for review May 20, 2025 10:10
@antonpirker antonpirker requested a review from IanWoodard May 20, 2025 10:10
@antonpirker antonpirker changed the title Make devservices forward compatible with Python SDK 3.0.0 chore: Make devservices forward compatible with Python SDK 3.0.0 May 20, 2025
@antonpirker antonpirker changed the title chore: Make devservices forward compatible with Python SDK 3.0.0 chore: Make devservices forward compatible with Python SDK 3.0.0 May 20, 2025
@antonpirker antonpirker merged commit 0181eee into main May 21, 2025
15 checks passed
@antonpirker antonpirker deleted the antonpirker/make-forward-compatible-with-sentry-sdk-3.0.0 branch May 21, 2025 07:39
sl0thentr0py added a commit to getsentry/sentry that referenced this pull request Jul 2, 2025
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
- getsentry/getsentry#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>
andrewshie-sentry pushed a commit to getsentry/sentry that referenced this pull request Jul 14, 2025
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
- getsentry/getsentry#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants