Skip to content

Commit 62560f3

Browse files
feat(api): Remove sentry_sdk.configure_scope
Also, remove any tests for `sentry_sdk.configure_scope`. Since Strawberry's deprecated [Sentry tracing extensions](https://strawberry.rocks/docs/extensions/sentry-tracing) import `sentry_sdk.configure_scope`, importing `strawberry.extensions.tracing.SentryTracingExtension` (or `SentryTracingExtensionSync`) will result in an unhandled exception. Therefore, these imports, and any functionality associated with them, have also been removed. This itself is not a breaking change, as it is necessitated by the removal of `sentry_sdk.configure_scope`. BREAKING CHANGE: Remove `sentry_sdk.configure_scope`. Closes: #3402
1 parent 3671a70 commit 62560f3

File tree

3 files changed

+0
-41
lines changed

3 files changed

+0
-41
lines changed

docs/api.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ Client Management
5151
Managing Scope (advanced)
5252
=========================
5353

54-
.. autofunction:: sentry_sdk.api.configure_scope
5554
.. autofunction:: sentry_sdk.api.push_scope
5655

5756
.. autofunction:: sentry_sdk.api.new_scope
58-

sentry_sdk/integrations/strawberry.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@
3131
from strawberry import Schema
3232
from strawberry.extensions import SchemaExtension # type: ignore
3333
from strawberry.extensions.tracing.utils import should_skip_tracing as strawberry_should_skip_tracing # type: ignore
34-
from strawberry.extensions.tracing import ( # type: ignore
35-
SentryTracingExtension as StrawberrySentryAsyncExtension,
36-
SentryTracingExtensionSync as StrawberrySentrySyncExtension,
37-
)
3834
from strawberry.http import async_base_view, sync_base_view # type: ignore
3935
except ImportError:
4036
raise DidNotEnable("strawberry-graphql is not installed")
@@ -104,14 +100,6 @@ def _sentry_patched_schema_init(self, *args, **kwargs):
104100
"False" if should_use_async_extension else "True",
105101
)
106102

107-
# remove the built in strawberry sentry extension, if present
108-
extensions = [
109-
extension
110-
for extension in extensions
111-
if extension
112-
not in (StrawberrySentryAsyncExtension, StrawberrySentrySyncExtension)
113-
]
114-
115103
# add our extension
116104
extensions.append(
117105
SentryAsyncExtension if should_use_async_extension else SentrySyncExtension
@@ -412,11 +400,6 @@ def inner(event, hint):
412400

413401
def _guess_if_using_async(extensions):
414402
# type: (List[SchemaExtension]) -> bool
415-
if StrawberrySentryAsyncExtension in extensions:
416-
return True
417-
elif StrawberrySentrySyncExtension in extensions:
418-
return False
419-
420403
return bool(
421404
{"starlette", "starlite", "litestar", "fastapi"} & set(_get_installed_modules())
422405
)

tests/integrations/strawberry/test_strawberry.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
from fastapi import FastAPI
1111
from fastapi.testclient import TestClient
1212
from flask import Flask
13-
from strawberry.extensions.tracing import (
14-
SentryTracingExtension,
15-
SentryTracingExtensionSync,
16-
)
1713
from strawberry.fastapi import GraphQLRouter
1814
from strawberry.flask.views import GraphQLView
1915

@@ -143,24 +139,6 @@ def test_infer_execution_type_from_installed_packages_sync(sentry_init):
143139
assert SentrySyncExtension in schema.extensions
144140

145141

146-
def test_replace_existing_sentry_async_extension(sentry_init):
147-
sentry_init(integrations=[StrawberryIntegration()])
148-
149-
schema = strawberry.Schema(Query, extensions=[SentryTracingExtension])
150-
assert SentryTracingExtension not in schema.extensions
151-
assert SentrySyncExtension not in schema.extensions
152-
assert SentryAsyncExtension in schema.extensions
153-
154-
155-
def test_replace_existing_sentry_sync_extension(sentry_init):
156-
sentry_init(integrations=[StrawberryIntegration()])
157-
158-
schema = strawberry.Schema(Query, extensions=[SentryTracingExtensionSync])
159-
assert SentryTracingExtensionSync not in schema.extensions
160-
assert SentryAsyncExtension not in schema.extensions
161-
assert SentrySyncExtension in schema.extensions
162-
163-
164142
@parameterize_strawberry_test
165143
def test_capture_request_if_available_and_send_pii_is_on(
166144
request,

0 commit comments

Comments
 (0)