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
10 changes: 5 additions & 5 deletions bin/split-silo-database
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@ def split_database(tables: list[str], source: str, destination: str, reset: bool


def revise_organization_mappings(legacy_region_name: str):
if settings.SENTRY_MONOLITH_REGION == legacy_region_name:
if settings.SENTRY_FALLBACK_CELL == legacy_region_name:
click.echo(
"> No OrganizationMapping have been modified. Set 'SENTRY_MONOLITH_REGION' in sentry.conf.py to update monolith mappings."
"> No OrganizationMapping have been modified. Set 'SENTRY_FALLBACK_CELL' in sentry.conf.py to update monolith mappings."
)
else:
qs = OrganizationMapping.objects.filter(cell_name=legacy_region_name)
record_count = len(qs)
qs.update(cell_name=settings.SENTRY_MONOLITH_REGION)
qs.update(cell_name=settings.SENTRY_FALLBACK_CELL)
click.echo(
f"> {record_count} OrganizationMapping record(s) have been updated from '{legacy_region_name}' to '{settings.SENTRY_MONOLITH_REGION}'"
f"> {record_count} OrganizationMapping record(s) have been updated from '{legacy_region_name}' to '{settings.SENTRY_FALLBACK_CELL}'"
)


@click.command()
@click.option(
"--legacy-region-name",
default="--monolith--",
help="Previous value of settings.SENTRY_MONOLITH_REGION to overwrite in organization mappings",
help="Previous value of settings.SENTRY_FALLBACK_CELL to overwrite in organization mappings",
)
@click.option("--verbose", default=False, is_flag=True, help="Enable verbose logging")
@click.option(
Expand Down
2 changes: 1 addition & 1 deletion src/apigw/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ def load_config(app: App) -> None:

from django.conf import settings

app.config.cells.default = settings.SENTRY_MONOLITH_REGION
app.config.cells.default = settings.SENTRY_FALLBACK_CELL
2 changes: 1 addition & 1 deletion src/sentry/core/endpoints/organization_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def validate(self, attrs):
attrs["cell_name"] = resolve_provisioning_cell(locality_name)
else:
# TODO(cells) Remove this when cell silo compatibility is removed.
attrs["cell_name"] = settings.SENTRY_LOCAL_CELL or settings.SENTRY_MONOLITH_REGION
attrs["cell_name"] = settings.SENTRY_LOCAL_CELL or settings.SENTRY_FALLBACK_CELL

return attrs

Expand Down
2 changes: 1 addition & 1 deletion src/sentry/feedback/endpoints/error_page_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def resolve(
if len(host_segments) - len(app_segments) < 3:
# If we don't have a o123.ingest.{cell}.{app_host} style domain
# we forward to the monolith cell
return get_cell_by_name(settings.SENTRY_MONOLITH_REGION)
return get_cell_by_name(settings.SENTRY_FALLBACK_CELL)

try:
cell_offset = len(app_segments) + 1
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/hybridcloud/apigateway/apigateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def proxy_request_if_needed(
request.resolver_match
and request.resolver_match.url_name in settings.REGION_PINNED_URL_NAMES
):
cell = get_cell_by_name(settings.SENTRY_MONOLITH_REGION)
cell = get_cell_by_name(settings.SENTRY_FALLBACK_CELL)
metrics.incr(
"apigateway.proxy_request",
tags={
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/hybridcloud/apigateway_async/apigateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def proxy_request_if_needed(
request.resolver_match
and request.resolver_match.url_name in settings.REGION_PINNED_URL_NAMES
):
cell = get_cell_by_name(settings.SENTRY_MONOLITH_REGION)
cell = get_cell_by_name(settings.SENTRY_FALLBACK_CELL)
metrics.incr(
"apigateway.proxy_request",
tags={
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/hybridcloud/rpc/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def resolve(self, arguments: ArgumentDict) -> Cell:
OrganizationMapping.objects.all().values_list("cell_name", flat=True).distinct()[:2]
)
if len(all_cell_names) == 0:
return get_cell_by_name(settings.SENTRY_MONOLITH_REGION)
return get_cell_by_name(settings.SENTRY_FALLBACK_CELL)
if len(all_cell_names) != 1:
raise CellResolutionError("Expected single-org environment to have only one cell")

Expand Down
2 changes: 1 addition & 1 deletion src/sentry/runner/commands/createorg.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def createorg(

try:
rpc_org = organization_provisioning_service.provision_organization_in_cell(
cell_name=settings.SENTRY_MONOLITH_REGION,
cell_name=settings.SENTRY_FALLBACK_CELL,
provisioning_options=provision_args,
)
except OrganizationProvisioningException as e:
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/testutils/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def request(**request: Any) -> Any:
# TODO: Can we infer the correct region here? would need to package up the
# the request dictionary into a higher level object, which also involves invoking
# _base_environ and maybe other logic buried in Client.....
cell = get_cell_by_name(settings.SENTRY_MONOLITH_REGION)
cell = get_cell_by_name(settings.SENTRY_FALLBACK_CELL)
with (
SingleProcessSiloModeState.exit(),
SingleProcessSiloModeState.enter(mode, cell),
Expand Down
22 changes: 11 additions & 11 deletions src/sentry/types/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def is_historic_monolith_region(self) -> bool:
cases to ensure that legacy data is handled correctly.
"""

return self.name == settings.SENTRY_MONOLITH_REGION
return self.name == settings.SENTRY_FALLBACK_CELL

def api_serialize(self) -> dict[str, Any]:
"""Serialize a Cell into a JSON compatible dict"""
Expand Down Expand Up @@ -229,10 +229,10 @@ def validate_all(self) -> None:
# SENTRY_MONOLITH_REGION is resolved as a live cell at runtime
# (historic monolith region lookups), so a dangling name should fail
# here rather than at request time.
if settings.SENTRY_MONOLITH_REGION not in defined_cells:
if settings.SENTRY_FALLBACK_CELL not in defined_cells:
raise CellConfigurationError(
"The SENTRY_MONOLITH_REGION setting must point to a cell name "
f"({settings.SENTRY_MONOLITH_REGION=!r}; "
"The SENTRY_FALLBACK_CELL setting must point to a cell name "
f"({settings.SENTRY_FALLBACK_CELL=!r}; "
f"cell names = {sorted(defined_cells)!r})"
)

Expand All @@ -254,10 +254,10 @@ def generate_monolith_cell_directory() -> CellDirectory:

Monolith environments (single-tenant, self-hosted) don't define
SENTRY_CELLS or SENTRY_LOCALITIES; they get a single cell named after
SENTRY_MONOLITH_REGION with a matching 1:1 locality.
SENTRY_FALLBACK_CELL with a matching 1:1 locality.
"""
cell = Cell(
name=settings.SENTRY_MONOLITH_REGION,
name=settings.SENTRY_FALLBACK_CELL,
snowflake_id=0,
address=options.get("system.url-prefix"),
)
Expand Down Expand Up @@ -420,7 +420,7 @@ def get_local_cell() -> Cell:
"""

if SiloMode.get_current_mode() == SiloMode.MONOLITH:
return get_cell_by_name(settings.SENTRY_MONOLITH_REGION)
return get_cell_by_name(settings.SENTRY_FALLBACK_CELL)

if SiloMode.get_current_mode() != SiloMode.CELL:
raise CellContextError("Not a cell silo")
Expand All @@ -435,7 +435,7 @@ def get_local_cell() -> Cell:

if not settings.SENTRY_LOCAL_CELL:
if in_test_environment():
return get_cell_by_name(settings.SENTRY_MONOLITH_REGION)
return get_cell_by_name(settings.SENTRY_FALLBACK_CELL)
else:
raise Exception("SENTRY_LOCAL_CELL must be set when server is in CELL silo mode")
return get_cell_by_name(settings.SENTRY_LOCAL_CELL)
Expand All @@ -456,7 +456,7 @@ def find_cells_for_orgs(org_ids: Iterable[int]) -> set[str]:
from sentry.models.organizationmapping import OrganizationMapping

if SiloMode.get_current_mode() == SiloMode.MONOLITH:
return {settings.SENTRY_MONOLITH_REGION}
return {settings.SENTRY_FALLBACK_CELL}
else:
return set(
OrganizationMapping.objects.filter(organization_id__in=org_ids).values_list(
Expand All @@ -468,7 +468,7 @@ def find_cells_for_orgs(org_ids: Iterable[int]) -> set[str]:
@control_silo_function
def find_cells_for_user(user_id: int) -> set[str]:
if SiloMode.get_current_mode() == SiloMode.MONOLITH:
return {settings.SENTRY_MONOLITH_REGION}
return {settings.SENTRY_FALLBACK_CELL}

org_ids = _find_orgs_for_user(user_id)
return find_cells_for_orgs(org_ids)
Expand All @@ -480,7 +480,7 @@ def find_cells_for_sentry_app(sentry_app: SentryApp) -> set[str]:
from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation

if SiloMode.get_current_mode() == SiloMode.MONOLITH:
return {settings.SENTRY_MONOLITH_REGION}
return {settings.SENTRY_FALLBACK_CELL}

organizations_with_installations = SentryAppInstallation.objects.filter(
sentry_app=sentry_app
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/web/client_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _get_public_dsn() -> str | None:
result = cache.get(cache_key)
if result is None:
key = project_key_service.get_project_key_by_cell(
cell_name=settings.SENTRY_MONOLITH_REGION,
cell_name=settings.SENTRY_FALLBACK_CELL,
project_id=project_id,
role=ProjectKeyRole.store,
)
Expand Down Expand Up @@ -370,7 +370,7 @@ def localities(self) -> list[Mapping[str, Any]]:
if not locality_names:
return [{"name": "default", "url": options.get("system.url-prefix")}]

monolith_locality = get_locality_name_for_cell(settings.SENTRY_MONOLITH_REGION)
monolith_locality = get_locality_name_for_cell(settings.SENTRY_FALLBACK_CELL)

def region_display_order(region: Locality) -> tuple[bool, bool, str]:
return (
Expand All @@ -395,7 +395,7 @@ def cells(self) -> list[Mapping[str, Any]]:

def cell_display_order(cell: Cell) -> tuple[bool, bool, str]:
return (
cell.name != settings.SENTRY_MONOLITH_REGION, # default historical cell comes first
cell.name != settings.SENTRY_FALLBACK_CELL, # default historical cell comes first
not cell.visible, # visible cells first
cell.name, # then sort alphabetically
)
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/web/frontend/mailgun_inbound_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def post(self, request: HttpRequest) -> HttpResponse:
org_mapping = OrganizationMapping.objects.get(organization_id=org_id)
region_name = org_mapping.cell_name
else:
region_name = settings.SENTRY_MONOLITH_REGION
region_name = settings.SENTRY_FALLBACK_CELL

# Email replies cannot be coaleseced so we
# need to generate unique object_identifier values.
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/web/frontend/shared_group_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def meta_tags(
else:
# Backwards compatibility for Self-hosted and single tenants
group = issue_service.get_shared_for_cell(
cell_name=settings.SENTRY_MONOLITH_REGION, share_id=share_id
cell_name=settings.SENTRY_FALLBACK_CELL, share_id=share_id
)

if not group:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def test_member_already_exists_with_member_id_from_another_organization(self) ->
self.login_as(user)
Factories.create_member(user=user, organization=self.organization, role="member")

with override_settings(SENTRY_LOCAL_CELL=settings.SENTRY_MONOLITH_REGION):
with override_settings(SENTRY_LOCAL_CELL=settings.SENTRY_FALLBACK_CELL):
other_organization = self.create_organization(
owner=self.create_user("otherowner@example.com")
)
Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/feedback/endpoints/test_error_page_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def test_resolver_ignores_port_when_extracting_host(self) -> None:
assert self._resolve(dsn) == ApiGatewayTestCase.CELL

def test_resolver_falls_back_to_monolith_region(self) -> None:
monolith_cell = get_cell_by_name(settings.SENTRY_MONOLITH_REGION)
monolith_cell = get_cell_by_name(settings.SENTRY_FALLBACK_CELL)

# Bare app host with no cell/ingest segments.
bare_dsn = f"https://{self.primary_key.public_key}@{self.app_host}/1"
Expand Down
12 changes: 6 additions & 6 deletions tests/sentry/organizations/services/test_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_returns_org_id_when_exactly_one_match(self) -> None:

assert (
organization_service.find_organization_id_by_option_value(
cell_name=settings.SENTRY_MONOLITH_REGION,
cell_name=settings.SENTRY_FALLBACK_CELL,
key=self.KEY,
value="acct_xyz",
)
Expand All @@ -102,7 +102,7 @@ def test_returns_none_when_no_rows_match(self) -> None:

assert (
organization_service.find_organization_id_by_option_value(
cell_name=settings.SENTRY_MONOLITH_REGION,
cell_name=settings.SENTRY_FALLBACK_CELL,
key=self.KEY,
value="acct_missing",
)
Expand All @@ -119,7 +119,7 @@ def test_returns_lowest_org_id_when_multiple_match(self) -> None:
self._set_option(org_b, self.KEY, "acct_collide")

result = organization_service.find_organization_id_by_option_value(
cell_name=settings.SENTRY_MONOLITH_REGION,
cell_name=settings.SENTRY_FALLBACK_CELL,
key=self.KEY,
value="acct_collide",
)
Expand All @@ -131,7 +131,7 @@ def test_value_match_is_exact_no_case_folding(self) -> None:

assert (
organization_service.find_organization_id_by_option_value(
cell_name=settings.SENTRY_MONOLITH_REGION,
cell_name=settings.SENTRY_FALLBACK_CELL,
key=self.KEY,
value="acct_xyz",
)
Expand All @@ -144,7 +144,7 @@ def test_value_match_does_not_strip_whitespace(self) -> None:

assert (
organization_service.find_organization_id_by_option_value(
cell_name=settings.SENTRY_MONOLITH_REGION,
cell_name=settings.SENTRY_FALLBACK_CELL,
key=self.KEY,
value=" acct_xyz ",
)
Expand All @@ -157,7 +157,7 @@ def test_returns_none_when_key_does_not_match(self) -> None:

assert (
organization_service.find_organization_id_by_option_value(
cell_name=settings.SENTRY_MONOLITH_REGION,
cell_name=settings.SENTRY_FALLBACK_CELL,
key=self.KEY,
value="acct_xyz",
)
Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/seer/test_test_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_start_unit_test_generation(mock_request: MagicMock) -> None:
mock_request.return_value.status = 200
mock_request.return_value.json.return_value = {}
response = test_generation_service.start_unit_test_generation(
cell_name=settings.SENTRY_MONOLITH_REGION,
cell_name=settings.SENTRY_FALLBACK_CELL,
github_org="some-org",
repo="some-repo",
pr_id=1,
Expand Down
4 changes: 2 additions & 2 deletions tests/sentry/web/test_client_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_client_config_default_locality_data() -> None:

assert len(result["localities"]) == 1
localities = result["localities"]
assert localities[0]["name"] == settings.SENTRY_MONOLITH_REGION
assert localities[0]["name"] == settings.SENTRY_FALLBACK_CELL
assert localities[0]["url"] == options.get("system.url-prefix")

assert len(result["cells"]) == 0, "No staff session"
Expand All @@ -208,7 +208,7 @@ def test_client_config_empty_region_data() -> None:
assert len(result["cells"]) == 0, "no staff session"
assert len(result["localities"]) == 1
localities = result["localities"]
assert localities[0]["name"] == settings.SENTRY_MONOLITH_REGION
assert localities[0]["name"] == settings.SENTRY_FALLBACK_CELL
assert localities[0]["url"] == options.get("system.url-prefix")


Expand Down
Loading