-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Support Python SDK 3.0.0 #92011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Python SDK 3.0.0 #92011
Conversation
…debase and also gone in SDK 3.0
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #92011 +/- ##
==========================================
+ Coverage 84.22% 88.00% +3.78%
==========================================
Files 10441 10439 -2
Lines 603621 603584 -37
Branches 23491 23444 -47
==========================================
+ Hits 508384 531177 +22793
+ Misses 94871 71901 -22970
- Partials 366 506 +140 |
I think this flake also exists on main. @joshuarli tagged me in a flaky test ticket that had the same issue. |
it's a bit flaky on mainline yeah -- but not to the level it is failing here |
…anges-for-sdk-3.0.0
only one test is failing now after the |
the test failure you see here is present on master, it's currently being debugged |
revert failed (conflict? already reverted?) -- check the logs |
Reverted because a change in issue grouping introduced by this release backlogged canary. We'll fix this and dogfood again next week. |
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 <[email protected]> Co-authored-by: Daniel Szoke <[email protected]> Co-authored-by: Ivana Kellyer <[email protected]> Co-authored-by: Neel Shah <[email protected]>
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:
sentry_sdk.start_transaction()
withsentry_sdk.start_span()
span.set_data()
withspan.set_attribute()
scope.transaction
withscope.root_span
Span.containing_transaction
withSpan.root_span
custom_sampling_context
withattributes
parametersentry_sdk.scope.get_*_scope()
withsentry_sdk.get_*_scope()
scope.add_attachment()
withsentry_sdk.add_attachment()
continue_trace()
to the new context manager.traces_sampler
to use newsampling_context
formatSee also the migration guide:
https://docs.sentry.io/platforms/python/migration/2.x-to-3.x
Related, but split out into separate PRs:
traces_sampler
works the same as before (check forsample_rate
): test: Add test for custom sample rates #93011get_isolation_scope
calls use the top-level API. Currently, some calls where wefrom sentry_sdk import Scope
then callScope.get_isolation_scope
still need to be converted to the top-level API: Cleanup imports to always use the top level api. #93307event["measurements"]
places if those can be removed (because SDK does not support measurements anymore): Remove usage ofmeasurements
in favor ofspan.data
. #92718set_span_data
toset_span_attribute
#92946with sentry_sdk.init(dsn=...)
withwith sentry_sdk.new_scope() as scope: scope.set_client(sentry_sdk.Client(dsn=...))
insrc/sentry/runner/main.py
: ref: Useset_client
to change DSN #92944propagate_hub=True
fromThreadingIntegration
: ref: Removepropagate_hub
toThreadingIntegration
#93016devenv
forward compatible with Sentry SDK 3.0.0 devenv#194devservices
forward compatible with Python SDK 3.0.0 devservices#277