Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sentry/cache/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _mark_transaction(self, op):
if not self.is_default_cache:
return

scope = sentry_sdk.Scope.get_current_scope()
scope = sentry_sdk.get_current_scope()
# Do not set this tag if we're in the global scope (which roughly
# equates to having a transaction).
if scope.transaction:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class OrganizationIntegrationSetupView(ControlSiloOrganizationView):
csrf_protect = False

def handle(self, request: HttpRequest, organization, provider_id) -> HttpResponseBase:
scope = sentry_sdk.Scope.get_current_scope()
scope = sentry_sdk.get_current_scope()
scope.set_transaction_name(f"integration.{provider_id}", source=TransactionSource.VIEW)

pipeline = IntegrationPipeline(
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/scim/endpoints/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

class SCIMApiError(APIException):
def __init__(self, detail, status_code=400):
transaction = sentry_sdk.Scope.get_current_scope().transaction
transaction = sentry_sdk.get_current_scope().transaction
if transaction is not None:
transaction.set_tag("http.status_code", status_code)
super().__init__({"schemas": [SCIM_API_ERROR], "detail": detail})
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/utils/concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def submit[
priority,
(
sentry_sdk.Scope.get_isolation_scope(),
sentry_sdk.Scope.get_current_scope(),
sentry_sdk.get_current_scope(),
callable,
future,
),
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/utils/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def check_current_scope_transaction(
Note: Ignores scope `transaction` values with `source = "custom"`, indicating a value which has
been set maunually.
"""
scope = sentry_sdk.Scope.get_current_scope()
scope = sentry_sdk.get_current_scope()
transaction_from_request = get_transaction_name_from_request(request)

if (
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/utils/snuba.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ def _apply_cache_and_build_results(
use_cache: bool | None = False,
) -> ResultSet:
parent_api: str = "<missing>"
scope = sentry_sdk.Scope.get_current_scope()
scope = sentry_sdk.get_current_scope()
if scope.transaction:
parent_api = scope.transaction.name

Expand Down Expand Up @@ -1162,7 +1162,7 @@ def _bulk_snuba_query(snuba_requests: Sequence[SnubaRequest]) -> ResultSet:
[
(
sentry_sdk.Scope.get_isolation_scope(),
sentry_sdk.Scope.get_current_scope(),
sentry_sdk.get_current_scope(),
snuba_request,
)
for snuba_request in snuba_requests_list
Expand All @@ -1175,7 +1175,7 @@ def _bulk_snuba_query(snuba_requests: Sequence[SnubaRequest]) -> ResultSet:
_snuba_query(
(
sentry_sdk.Scope.get_isolation_scope(),
sentry_sdk.Scope.get_current_scope(),
sentry_sdk.get_current_scope(),
snuba_requests_list[0],
)
)
Expand Down
6 changes: 2 additions & 4 deletions src/sentry/utils/snuba_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _make_rpc_requests(
partial_request = partial(
_make_rpc_request,
thread_isolation_scope=sentry_sdk.Scope.get_isolation_scope(),
thread_current_scope=sentry_sdk.Scope.get_current_scope(),
thread_current_scope=sentry_sdk.get_current_scope(),
)
response = [
result
Expand Down Expand Up @@ -253,9 +253,7 @@ def _make_rpc_request(
else thread_isolation_scope
)
thread_current_scope = (
sentry_sdk.Scope.get_current_scope()
if thread_current_scope is None
else thread_current_scope
sentry_sdk.get_current_scope() if thread_current_scope is None else thread_current_scope
)
if SNUBA_INFO:
from google.protobuf.json_format import MessageToJson
Expand Down
4 changes: 2 additions & 2 deletions tests/sentry/utils/test_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def test_scope_has_correct_transaction(self, mock_resolve: MagicMock):
mock_scope = Scope()
mock_scope._transaction = "/dogs/{name}/"

with patch("sentry.utils.sdk.sentry_sdk.Scope.get_current_scope", return_value=mock_scope):
with patch("sentry.utils.sdk.sentry_sdk.get_current_scope", return_value=mock_scope):
mismatch = check_current_scope_transaction(Request(HttpRequest()))
assert mismatch is None

Expand All @@ -225,7 +225,7 @@ def test_scope_has_wrong_transaction(self, mock_resolve: MagicMock):
mock_scope = Scope()
mock_scope._transaction = "/tricks/{trick_name}/"

with patch("sentry.utils.sdk.sentry_sdk.Scope.get_current_scope", return_value=mock_scope):
with patch("sentry.utils.sdk.sentry_sdk.get_current_scope", return_value=mock_scope):
mismatch = check_current_scope_transaction(Request(HttpRequest()))
assert mismatch == {
"scope_transaction": "/tricks/{trick_name}/",
Expand Down
Loading