Skip to content
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

Emit deprecation warnings for Hub-based APIs #3265

Closed
szokeasaurusrex opened this issue Jul 10, 2024 · 1 comment · Fixed by #3280
Closed

Emit deprecation warnings for Hub-based APIs #3265

szokeasaurusrex opened this issue Jul 10, 2024 · 1 comment · Fixed by #3280
Assignees

Comments

@szokeasaurusrex
Copy link
Member

Per our documentation, all Hub-based APIs have been deprecated since 2.0.0, but we have not been emitting deprecation warnings yet, because we still use Hub APIs in a few places.

We should add deprecation warnings for all Hub-based APIs.

Before we can do this, we need to remove all remaining Hub API usages (besides those needed for backwards-compatibility) from the SDK.

szokeasaurusrex added a commit that referenced this issue Jul 10, 2024
Rename `Transaction.finish` method's `hub` parameter to `scope` (in a backwards-compatible manner), and update the method so that it is using `Scope` API under the hood as much as possible.

Prerequisite for #3265
szokeasaurusrex added a commit that referenced this issue Jul 10, 2024
Rename `Transaction.finish` method's `hub` parameter to `scope` (in a backwards-compatible manner), and update the method so that it is using `Scope` API under the hood as much as possible.

Prerequisite for #3265
szokeasaurusrex added a commit that referenced this issue Jul 10, 2024
Get the client via `sentry_sdk.get_client()` instead.

Prerequisite for #3265
szokeasaurusrex added a commit that referenced this issue Jul 10, 2024
Get the client via `sentry_sdk.get_client()` instead.

Prerequisite for #3265
szokeasaurusrex added a commit that referenced this issue Jul 10, 2024
@szokeasaurusrex szokeasaurusrex self-assigned this Jul 10, 2024
szokeasaurusrex added a commit that referenced this issue Jul 10, 2024
Rename `Transaction.finish` method's `hub` parameter to `scope` (in a backwards-compatible manner), and update the method so that it is using `Scope` API under the hood as much as possible.

Prerequisite for #3265
szokeasaurusrex added a commit that referenced this issue Jul 11, 2024
szokeasaurusrex added a commit that referenced this issue Jul 11, 2024
@szokeasaurusrex
Copy link
Member Author

Following offline discussion with @antonpirker, we will only warn when:

  • Calling Hub.__init__
  • Accessing Hub.current or Hub.main

The idea here is that all other Hub APIs can only be accessed after obtaining a Hub object, which one can only do with one of the above methods. Once we have warned the user once that using the Hub is deprecated, we don't need to warn every other time they call a method on the hub.

szokeasaurusrex added a commit that referenced this issue Jul 11, 2024
`sentry_sdk.Hub` has been deprecated since Sentry SDK version 2.0.0 per our docs; however, we waited with adding deprecation warnings because the SDK itself was still using `Hub` APIs until recently.

Since we no longer use `Hub` APIs in the SDK (except in `Hub` APIs which are themselves deprecated), we can now start emitting deprecation warnings.

Closes #3265
szokeasaurusrex added a commit that referenced this issue Jul 16, 2024
`sentry_sdk.Hub` has been deprecated since Sentry SDK version 2.0.0 per our docs; however, we waited with adding deprecation warnings because the SDK itself was still using `Hub` APIs until recently.

Since we no longer use `Hub` APIs in the SDK (except in `Hub` APIs which are themselves deprecated), we can now start emitting deprecation warnings.

Closes #3265
szokeasaurusrex added a commit that referenced this issue Jul 16, 2024
`sentry_sdk.Hub` has been deprecated since Sentry SDK version 2.0.0 per our docs; however, we waited with adding deprecation warnings because the SDK itself was still using `Hub` APIs until recently.

Since we no longer use `Hub` APIs in the SDK (except in `Hub` APIs which are themselves deprecated), we can now start emitting deprecation warnings.

Closes #3265
szokeasaurusrex added a commit that referenced this issue Jul 22, 2024
`sentry_sdk.Hub` has been deprecated since Sentry SDK version 2.0.0 per our docs; however, we waited with adding deprecation warnings because the SDK itself was still using `Hub` APIs until recently.

Since we no longer use `Hub` APIs in the SDK (except in `Hub` APIs which are themselves deprecated), we can now start emitting deprecation warnings.

Closes #3265
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this issue Sep 30, 2024
Get the client via `sentry_sdk.get_client()` instead.

Prerequisite for getsentry#3265
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this issue Sep 30, 2024
Rename `Transaction.finish` method's `hub` parameter to `scope` (in a backwards-compatible manner), and update the method so that it is using `Scope` API under the hood as much as possible.

Prerequisite for getsentry#3265
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this issue Sep 30, 2024
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this issue Sep 30, 2024
`sentry_sdk.Hub` has been deprecated since Sentry SDK version 2.0.0 per our docs; however, we waited with adding deprecation warnings because the SDK itself was still using `Hub` APIs until recently.

Since we no longer use `Hub` APIs in the SDK (except in `Hub` APIs which are themselves deprecated), we can now start emitting deprecation warnings.

Closes getsentry#3265
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 a pull request may close this issue.

1 participant