Skip to content

Commit 6920ebc

Browse files
markstoryryan953
authored andcommitted
chore(cells) Add deprecation notices for a few issue endpoints (#104471)
As part of the cells project we need to deprecate URLs that don't have organization_slug_or_id in them. This change adds deprecations to a few issues endpoints for the org-less URL. I've only updated a couple endpoints to start with so that I can validate behavior before updating the remaining issue endpoints. Refs INFRENG-208
1 parent 9aa2714 commit 6920ebc

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

src/sentry/api/helpers/deprecation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def get(self, request):
132132
:param key: The key prefix for an option use for the brownout schedule and duration
133133
If not set 'api.deprecation.brownout' will be used, which currently
134134
is using schedule of a 1 minute blackout at noon UTC.
135+
:param url_names: A list of URL names that are deprecated if an endpoint has multiple URLs
136+
and you need to deprecate one of the URLs.
135137
"""
136138

137139
def decorator(func: EndpointT[SelfT, P]) -> EndpointT[SelfT, P]:

src/sentry/constants.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os.path
88
from collections import namedtuple
99
from collections.abc import Sequence
10-
from datetime import timedelta
10+
from datetime import UTC, datetime, timedelta
1111
from enum import Enum
1212
from typing import cast
1313

@@ -1053,3 +1053,7 @@ class InsightModules(Enum):
10531053
"dsr": "visual basic 6.0",
10541054
"frm": "visual basic 6.0",
10551055
}
1056+
1057+
# After this date APIs that are incompatible with cell routing
1058+
# will begin periodic brownouts.
1059+
CELL_API_DEPRECATION_DATE = datetime(2025, 5, 15, 0, 0, 0, tzinfo=UTC)

src/sentry/issues/endpoints/organization_group_suspect_flags.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
from sentry import features
99
from sentry.api.api_publish_status import ApiPublishStatus
1010
from sentry.api.base import region_silo_endpoint
11+
from sentry.api.helpers.deprecation import deprecated
1112
from sentry.api.helpers.environments import get_environments
1213
from sentry.api.utils import get_date_range_from_params
14+
from sentry.constants import CELL_API_DEPRECATION_DATE
1315
from sentry.issues.endpoints.bases.group import GroupEndpoint
1416
from sentry.issues.suspect_flags import Distribution, get_suspect_flag_scores
1517
from sentry.models.group import Group
@@ -32,6 +34,7 @@ class ResponseData(TypedDict):
3234
class OrganizationGroupSuspectFlagsEndpoint(GroupEndpoint):
3335
publish_status = {"GET": ApiPublishStatus.PRIVATE}
3436

37+
@deprecated(CELL_API_DEPRECATION_DATE, url_names=["sentry-api-0-suspect-flags"])
3538
def get(self, request: Request, group: Group) -> Response:
3639
"""Stats bucketed by time."""
3740
if not features.has(

src/sentry/issues/endpoints/organization_group_suspect_tags.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
from sentry import features
77
from sentry.api.api_publish_status import ApiPublishStatus
88
from sentry.api.base import region_silo_endpoint
9+
from sentry.api.helpers.deprecation import deprecated
910
from sentry.api.helpers.environments import get_environments
1011
from sentry.api.utils import get_date_range_from_params
12+
from sentry.constants import CELL_API_DEPRECATION_DATE
1113
from sentry.issues.endpoints.bases.group import GroupEndpoint
1214
from sentry.issues.suspect_tags import get_suspect_tag_scores
1315
from sentry.models.group import Group
@@ -17,6 +19,7 @@
1719
class OrganizationGroupSuspectTagsEndpoint(GroupEndpoint):
1820
publish_status = {"GET": ApiPublishStatus.PRIVATE}
1921

22+
@deprecated(CELL_API_DEPRECATION_DATE, url_names=["sentry-api-0-suspect-tags"])
2023
def get(self, request: Request, group: Group) -> Response:
2124
"""Stats bucketed by time."""
2225
if not features.has(

0 commit comments

Comments
 (0)