From da729945baaf77b6c228d1df170e0d9232fb0521 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Fri, 5 Dec 2025 14:45:41 -0500 Subject: [PATCH 1/2] chore(cells) Add deprecation notices for a few issue endpoints 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. Refs INFRENG-208 --- src/sentry/api/helpers/deprecation.py | 2 ++ src/sentry/constants.py | 6 +++++- .../issues/endpoints/organization_group_suspect_flags.py | 3 +++ .../issues/endpoints/organization_group_suspect_tags.py | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/sentry/api/helpers/deprecation.py b/src/sentry/api/helpers/deprecation.py index c22248c702c8f0..bf6483b6e9fbbf 100644 --- a/src/sentry/api/helpers/deprecation.py +++ b/src/sentry/api/helpers/deprecation.py @@ -132,6 +132,8 @@ def get(self, request): :param key: The key prefix for an option use for the brownout schedule and duration If not set 'api.deprecation.brownout' will be used, which currently is using schedule of a 1 minute blackout at noon UTC. + :param url_names: A list of URL names that are deprecated if an endpoint has multiple URLs + and you need to deprecate one of the URLs. """ def decorator(func: EndpointT[SelfT, P]) -> EndpointT[SelfT, P]: diff --git a/src/sentry/constants.py b/src/sentry/constants.py index a48f5bd1a9ded5..c3acf4a2a85411 100644 --- a/src/sentry/constants.py +++ b/src/sentry/constants.py @@ -7,7 +7,7 @@ import os.path from collections import namedtuple from collections.abc import Sequence -from datetime import timedelta +from datetime import datetime, timedelta from enum import Enum from typing import cast @@ -1053,3 +1053,7 @@ class InsightModules(Enum): "dsr": "visual basic 6.0", "frm": "visual basic 6.0", } + +# After this date APIs that are incompatible with cell routing +# will begin periodic brownouts. +CELL_API_DEPRECATION_DATE = datetime(2025, 5, 15) diff --git a/src/sentry/issues/endpoints/organization_group_suspect_flags.py b/src/sentry/issues/endpoints/organization_group_suspect_flags.py index 0378dc4b8cffbc..d170b0b2f04ea8 100644 --- a/src/sentry/issues/endpoints/organization_group_suspect_flags.py +++ b/src/sentry/issues/endpoints/organization_group_suspect_flags.py @@ -8,8 +8,10 @@ from sentry import features from sentry.api.api_publish_status import ApiPublishStatus from sentry.api.base import region_silo_endpoint +from sentry.api.helpers.deprecation import deprecated from sentry.api.helpers.environments import get_environments from sentry.api.utils import get_date_range_from_params +from sentry.constants import CELL_API_DEPRECATION_DATE from sentry.issues.endpoints.bases.group import GroupEndpoint from sentry.issues.suspect_flags import Distribution, get_suspect_flag_scores from sentry.models.group import Group @@ -32,6 +34,7 @@ class ResponseData(TypedDict): class OrganizationGroupSuspectFlagsEndpoint(GroupEndpoint): publish_status = {"GET": ApiPublishStatus.PRIVATE} + @deprecated(CELL_API_DEPRECATION_DATE, url_names=["sentry-api-0-suspect-flags"]) def get(self, request: Request, group: Group) -> Response: """Stats bucketed by time.""" if not features.has( diff --git a/src/sentry/issues/endpoints/organization_group_suspect_tags.py b/src/sentry/issues/endpoints/organization_group_suspect_tags.py index ffb10dae663286..73d33b00b93ca8 100644 --- a/src/sentry/issues/endpoints/organization_group_suspect_tags.py +++ b/src/sentry/issues/endpoints/organization_group_suspect_tags.py @@ -6,8 +6,10 @@ from sentry import features from sentry.api.api_publish_status import ApiPublishStatus from sentry.api.base import region_silo_endpoint +from sentry.api.helpers.deprecation import deprecated from sentry.api.helpers.environments import get_environments from sentry.api.utils import get_date_range_from_params +from sentry.constants import CELL_API_DEPRECATION_DATE from sentry.issues.endpoints.bases.group import GroupEndpoint from sentry.issues.suspect_tags import get_suspect_tag_scores from sentry.models.group import Group @@ -17,6 +19,7 @@ class OrganizationGroupSuspectTagsEndpoint(GroupEndpoint): publish_status = {"GET": ApiPublishStatus.PRIVATE} + @deprecated(CELL_API_DEPRECATION_DATE, url_names=["sentry-api-0-suspect-tags"]) def get(self, request: Request, group: Group) -> Response: """Stats bucketed by time.""" if not features.has( From dc083705d81f51abe7a3679ee26d7b684ba125ff Mon Sep 17 00:00:00 2001 From: Mark Story Date: Fri, 5 Dec 2025 15:11:52 -0500 Subject: [PATCH 2/2] Fix tz --- src/sentry/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sentry/constants.py b/src/sentry/constants.py index c3acf4a2a85411..aebadfa7be2d89 100644 --- a/src/sentry/constants.py +++ b/src/sentry/constants.py @@ -7,7 +7,7 @@ import os.path from collections import namedtuple from collections.abc import Sequence -from datetime import datetime, timedelta +from datetime import UTC, datetime, timedelta from enum import Enum from typing import cast @@ -1056,4 +1056,4 @@ class InsightModules(Enum): # After this date APIs that are incompatible with cell routing # will begin periodic brownouts. -CELL_API_DEPRECATION_DATE = datetime(2025, 5, 15) +CELL_API_DEPRECATION_DATE = datetime(2025, 5, 15, 0, 0, 0, tzinfo=UTC)