-
-
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
Open
antonpirker
wants to merge
82
commits into
master
Choose a base branch
from
antonpirker/code-changes-for-sdk-3.0.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Support Python SDK 3.0.0 #92011
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…debase and also gone in SDK 3.0
❌ 3 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
<!-- Describe your PR here. --> <!-- Sentry employees and contractors can delete or ignore the following. --> ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
shellmayr
pushed a commit
that referenced
this pull request
Jun 12, 2025
`with sentry_sdk.init` is deprecated and will be removed in Sentry SDK 3.0. Split off from #92011 <!-- Describe your PR here. --> <!-- Sentry employees and contractors can delete or ignore the following. --> ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
there seems to be a lot of unrelated changes in this PR? |
are there? some new sdk-related tests, other than that it's a mass-replace |
andrewshie-sentry
pushed a commit
that referenced
this pull request
Jun 19, 2025
`with sentry_sdk.init` is deprecated and will be removed in Sentry SDK 3.0. Split off from #92011 <!-- Describe your PR here. --> <!-- Sentry employees and contractors can delete or ignore the following. --> ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
andrewshie-sentry
pushed a commit
that referenced
this pull request
Jun 19, 2025
This parameter is deprecated as of Sentry SDK 2.0.0; the default value is now `True`, so passing this parameter is no longer needed. Split off from #92011
andrewshie-sentry
pushed a commit
that referenced
this pull request
Jun 19, 2025
Using `sentry_sdk.Scope.get_current_scope` has been deprecated in favor of `sentry_sdk.get_current_scope`. Going forward, we generally would like SDK users to stick to the top-level APIs. Split off from #92011. Stacked on: - #93016 <!-- Describe your PR here. --> <!-- Sentry employees and contractors can delete or ignore the following. --> ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
andrewshie-sentry
pushed a commit
that referenced
this pull request
Jun 19, 2025
Migrate calls of `sentry_sdk.Scope.get_isolation_scope` to `sentry_sdk.get_isolation_scope`. Calls where `Scope` is first imported and then where `Scope.get_isolation_scope` is called are left as-is; we will address those separately. Split off from #92011. <!-- Describe your PR here. --> <!-- Sentry employees and contractors can delete or ignore the following. --> ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
andrewshie-sentry
pushed a commit
that referenced
this pull request
Jun 19, 2025
Migrate calls of `sentry_sdk.Scope.get_global_scope` to `sentry_sdk.get_global_scope`. Split off from #92011. <!-- Describe your PR here. --> <!-- Sentry employees and contractors can delete or ignore the following. --> ### Legal Boilerplate Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Do Not Merge
Don't merge
Scope: Backend
Automatically applied to PRs that change backend components
Scope: Frontend
Automatically applied to PRs that change frontend components
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[work in progress]
Update the code so it works with the upcoming major release of the Sentry Python SDK 3.0.0.
Sentry SDK
3.0.0
has massive changes on how the data flows through the SDK compared to2.x
. (3.0 uses Opentelementry under the hood to create spans)Some APIs in 3.0 is not backwards compatible with 2.x so we need to change a lot of call sites.
What this PR does:
.start_transaction()
to.start_span()
(without ever settingonly_if_parent
)span.set_data()
withspan.set_attribute()
with the same paramscontinue_trace()
to the new context manager.scope.add_attachment()
tosentry_sdk.add_attachment()
scope.transaction
withscope.root_span
Span.containing_transaction
withSpan.root_span
start_span()
can NOT be a dict. (Note: It only hadsample_rate
set which is a float.sampled=False
from assigning to a span into thestart_span()
call.custom_sampling_context
withattributes
parameter in@trace_func
custom_sampling_context
param in.start_span()
withattributes
custom_sampling_context
everywhere in code base (given to spans)@metrics_noop
decorator, because there are no metrics anymore onlyspan.data
, so we do not need it.src/sentry/utils/sdk.py::set_measurement()
because it is not used insentry
.set_attribute()
value is NOT adict
. See: Do not usedicts
in.set_data()
. #92720Related, but split out in separate PRs:
make sureDone here: test: Add test for custom sample rates #93011traces_sampler
works the same as before (check forsample_rate
)Make allDone here: Cleanup imports to always use the top level api. #93307get_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. Do this in a separate PR.checksplit into: Remove usage ofevent["measurements"]
places if those can be removed (because SDK does not support measurements anymore).measurements
in favor ofspan.data
. #92718change set_span_data() to set_span_attribute() but check for value NOT be a dict.(split off into ref: Renameset_span_data
toset_span_attribute
#92946)replaced(split into ref: Usewith sentry_sdk.init(dsn=...)
withwith sentry_sdk.new_scope() as scope: scope.set_client(sentry_sdk.Client(dsn=...))
insrc/sentry/runner/main.py
set_client
to change DSN #92944)removed(ref: Removepropagate_hub=True
fromThreadingIntegration
propagate_hub
toThreadingIntegration
#93016)removed minimetrics from the sentry codebase, because the metrics product was never released.(Remove minimetrics #93595)requires https://github.com/getsentry/getsentry/pull/17553
requires getsentry/devenv#194
requires getsentry/devservices#277
requires getsentry/pytest-sentry#39
requires getsentry/sentry-docs#13939