Skip to content

Commit 81a5d2e

Browse files
authored
Merge branch 'master' into docs/dotnet-stable-metrics-apis
2 parents 078e9f0 + 0207f7f commit 81a5d2e

File tree

71 files changed

+1383
-705
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1383
-705
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ tests/sentry/api/endpoints/test_organization_attribute_mappings.py @get
677677
/tests/sentry/issues/test_search_issues_dataset.py @getsentry/issue-workflow
678678
/tests/sentry/issues/test_status_change_consumer.py @getsentry/issue-detection-backend
679679
/tests/sentry/issues/test_status_change.py @getsentry/issue-detection-backend
680+
/tests/sentry/processing_errors/ @getsentry/issue-detection-backend
680681
/tests/sentry/search/ @getsentry/issue-workflow
681682
/tests/sentry/seer/similarity/ @getsentry/issue-detection-backend
682683
/tests/sentry/seer/supergroups/ @getsentry/issue-detection-backend

.github/codeowners-coverage-baseline.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,12 +2370,6 @@ tests/sentry/processing/backpressure/test_checking.py
23702370
tests/sentry/processing/backpressure/test_monitoring.py
23712371
tests/sentry/processing/backpressure/test_redis.py
23722372
tests/sentry/processing/eventstore/test_processing.py
2373-
tests/sentry/processing_errors/__init__.py
2374-
tests/sentry/processing_errors/eap/__init__.py
2375-
tests/sentry/processing_errors/eap/test_producer.py
2376-
tests/sentry/processing_errors/test_detection.py
2377-
tests/sentry/processing_errors/test_grouptype.py
2378-
tests/sentry/processing_errors/test_provisioning.py
23792373
tests/sentry/projectoptions/__init__.py
23802374
tests/sentry/projectoptions/test_basic.py
23812375
tests/sentry/projects/project_rules/test_creator.py

src/sentry/api/bases/rule.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def convert_args(
4242

4343

4444
class WorkflowEngineRuleEndpoint(RuleEndpoint):
45+
# Subclasses may set a per-method granular flag (e.g. for GET) that is OR'd
46+
# with the broad workflow-engine-rule-serializers flag.
47+
workflow_engine_method_flags: dict[str, str] = {}
48+
4549
def convert_args(
4650
self, request: Request, rule_id: str, *args: Any, **kwargs: Any
4751
) -> tuple[Any, Any]:
@@ -51,7 +55,11 @@ def convert_args(
5155
if not rule_id.isdigit():
5256
raise ResourceDoesNotExist
5357

54-
if features.has("organizations:workflow-engine-rule-serializers", project.organization):
58+
method_flag = self.workflow_engine_method_flags.get(request.method or "")
59+
use_workflow_engine = features.has(
60+
"organizations:workflow-engine-rule-serializers", project.organization
61+
) or (method_flag is not None and features.has(method_flag, project.organization))
62+
if use_workflow_engine:
5563
try:
5664
arw = AlertRuleWorkflow.objects.get(
5765
rule_id=rule_id, workflow__organization=project.organization

src/sentry/api/endpoints/project_rule_details.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ class ProjectRuleDetailsPutSerializer(serializers.Serializer):
103103
@extend_schema(tags=["Alerts"])
104104
@cell_silo_endpoint
105105
class ProjectRuleDetailsEndpoint(WorkflowEngineRuleEndpoint):
106+
workflow_engine_method_flags = {
107+
"GET": "organizations:workflow-engine-projectruledetailsendpoint-get",
108+
}
106109
publish_status = {
107110
"DELETE": ApiPublishStatus.PUBLIC,
108111
"GET": ApiPublishStatus.PUBLIC,

src/sentry/api/urls.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@
560560
from sentry.seer.supergroups.endpoints.organization_supergroups import (
561561
OrganizationSupergroupsEndpoint,
562562
)
563+
from sentry.seer.supergroups.endpoints.organization_supergroups_by_group import (
564+
OrganizationSupergroupsByGroupEndpoint,
565+
)
563566
from sentry.sentry_apps.api.endpoints.group_external_issue_details import (
564567
GroupExternalIssueDetailsEndpoint,
565568
)
@@ -2418,6 +2421,11 @@ def create_group_urls(name_prefix: str) -> list[URLPattern | URLResolver]:
24182421
OrganizationSupergroupsEndpoint.as_view(),
24192422
name="sentry-api-0-organization-supergroups",
24202423
),
2424+
re_path(
2425+
r"^(?P<organization_id_or_slug>[^/]+)/seer/supergroups/by-group/$",
2426+
OrganizationSupergroupsByGroupEndpoint.as_view(),
2427+
name="sentry-api-0-organization-supergroups-by-group",
2428+
),
24212429
re_path(
24222430
r"^(?P<organization_id_or_slug>[^/]+)/seer/supergroups/(?P<supergroup_id>[^/]+)/$",
24232431
OrganizationSupergroupDetailsEndpoint.as_view(),

src/sentry/features/temporary.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ def register_temporary_features(manager: FeatureManager) -> None:
434434
# Use workflow engine exclusively for ProjectRulesEndpoint.get results.
435435
# See src/sentry/workflow_engine/docs/legacy_backport.md for context.
436436
manager.add("organizations:workflow-engine-projectrulesendpoint-get", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
437+
# Use workflow engine exclusively for ProjectRuleDetailsEndpoint.get results.
438+
# See src/sentry/workflow_engine/docs/legacy_backport.md for context.
439+
manager.add("organizations:workflow-engine-projectruledetailsendpoint-get", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
437440
# Enable metric detector limits by plan type
438441
manager.add("organizations:workflow-engine-metric-detector-limit", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
439442
# Enable EventUniqueUserFrequencyConditionWithConditions special alert condition

src/sentry/hybridcloud/rpc/resolvers.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,14 @@ def _get_from_mapping(**query: Any) -> Cell:
3737

3838
@dataclass(frozen=True)
3939
class ByCellName(CellResolutionStrategy):
40-
"""Resolve from a `str` parameter representing a cell's name.
41-
42-
Accepts either ``cell_name`` or ``region_name`` to ease the migration of
43-
service method parameters from the old name to the new one.
40+
"""
41+
Resolve from a `str` parameter representing a cell's name.
4442
"""
4543

4644
parameter_name: str = "cell_name"
4745

4846
def resolve(self, arguments: ArgumentDict) -> Cell:
49-
# TODO(cells): Temporary fall back to "region_name" while service methods are being migrated.
50-
cell_name = arguments.get("region_name") or arguments[self.parameter_name]
47+
cell_name = arguments[self.parameter_name]
5148
return get_cell_by_name(cell_name)
5249

5350

src/sentry/hybridcloud/services/control_organization_provisioning/impl.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ def _validate_organization_mapping_belongs_to_user(
8989
return False
9090

9191
@staticmethod
92-
def _generate_org_snowflake_id(region_name: str) -> int:
92+
def _generate_org_snowflake_id() -> int:
9393
return generate_snowflake_id(Organization.snowflake_redis_key)
9494

9595
@staticmethod
96-
def _generate_org_slug(region_name: str, slug: str) -> str:
96+
def _generate_org_slug(slug: str) -> str:
9797
slug_base = slug.replace("_", "-").strip("-")
9898
surrogate_org_slug = OrganizationSlugReservation()
9999
slugify_instance(surrogate_org_slug, slug_base, reserved=RESERVED_ORGANIZATION_SLUGS)
@@ -133,12 +133,10 @@ def provision_organization(
133133
org_provision_args: OrganizationProvisioningOptions,
134134
) -> RpcOrganizationSlugReservation:
135135
# Generate a new non-conflicting slug and org ID
136-
org_id = self._generate_org_snowflake_id(region_name=cell_name)
137-
slug = self._generate_org_slug(
138-
region_name=cell_name, slug=org_provision_args.provision_options.slug
139-
)
136+
org_id = self._generate_org_snowflake_id()
137+
slug = self._generate_org_slug(slug=org_provision_args.provision_options.slug)
140138

141-
# Generate a provisioning outbox for the region and drain
139+
# Generate a provisioning outbox for the cell and drain
142140
updated_provision_options = deepcopy(org_provision_args.provision_options)
143141
updated_provision_options.slug = slug
144142
provision_payload = OrganizationProvisioningOptions(
@@ -209,7 +207,7 @@ def update_organization_slug(
209207

210208
slug_base = desired_slug
211209
if not require_exact:
212-
slug_base = self._generate_org_slug(region_name=cell_name, slug=slug_base)
210+
slug_base = self._generate_org_slug(slug=slug_base)
213211

214212
try:
215213
with outbox_context(
@@ -296,7 +294,7 @@ def bulk_create_organization_slug_reservations(
296294
with outbox_context(transaction.atomic(router.db_for_write(OrganizationSlugReservation))):
297295
for org_id, slug in slug_mapping.items():
298296
slug_reservation = OrganizationSlugReservation(
299-
slug=self._generate_org_slug(slug=slug, region_name=cell_name),
297+
slug=self._generate_org_slug(slug=slug),
300298
organization_id=org_id,
301299
reservation_type=OrganizationSlugReservationType.TEMPORARY_RENAME_ALIAS.value,
302300
user_id=-1,

src/sentry/hybridcloud/services/control_organization_provisioning/service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ def update_organization_slug(
4545
) -> RpcOrganizationSlugReservation:
4646
"""
4747
Updates an organization's slug via an outbox based confirmation flow to ensure that the control
48-
and region silos stay in sync.
48+
and cell silos stay in sync.
4949
5050
Initially, the organization slug reservation is updated in control silo, which generates a replica
51-
outbox to the desired region in order to ensure that a slug change in control _will eventually_
52-
result in a slug change on the region side.
51+
outbox to the desired cell in order to ensure that a slug change in control _will eventually_
52+
result in a slug change on the cell side.
5353
5454
:param cell_name: The cell where the organization exists
5555
:param organization_id: the ID of the organization whose slug to change

src/sentry/hybridcloud/services/organization_mapping/impl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _check_organization_mapping_integrity(
6161

6262
if not update.cell_name:
6363
capture_exception(
64-
OrganizationMappingConsistencyException("Organization mapping must have a region")
64+
OrganizationMappingConsistencyException("Organization mapping must have a cell")
6565
)
6666
return False
6767

@@ -81,11 +81,11 @@ def _check_organization_mapping_integrity(
8181
)
8282
return False
8383

84-
org_slug_regions_set = {org_slug.cell_name for org_slug in org_slugs}
85-
if update.cell_name not in org_slug_regions_set:
84+
org_slug_cells_set = {org_slug.cell_name for org_slug in org_slugs}
85+
if update.cell_name not in org_slug_cells_set:
8686
capture_exception(
8787
OrganizationMappingConsistencyException(
88-
"Mismatched Slug Reservation and Organization Regions"
88+
"Mismatched Slug Reservation and Organization Cells"
8989
)
9090
)
9191
return False

0 commit comments

Comments
 (0)