From ff87f5e27b37384029f66b76bdd20fe4902458b6 Mon Sep 17 00:00:00 2001 From: Armen Zambrano G <44410+armenzg@users.noreply.github.com> Date: Tue, 14 May 2024 09:38:16 -0400 Subject: [PATCH] deprecate(related_issues): Drop support for doing all types of related issues (#70793) This is a follow-up to https://github.com/getsentry/sentry/pull/70504. Once the UI stops using this approach we will merge this change. This got temporarily reverted in #70606 since we had to revert the UI PR. --- src/sentry/api/endpoints/issues/related_issues.py | 14 +++----------- src/sentry/issues/related/__init__.py | 11 ----------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/sentry/api/endpoints/issues/related_issues.py b/src/sentry/api/endpoints/issues/related_issues.py index 6a1104e73f27fb..d5606ab2a9a35d 100644 --- a/src/sentry/api/endpoints/issues/related_issues.py +++ b/src/sentry/api/endpoints/issues/related_issues.py @@ -5,7 +5,6 @@ from sentry.api.api_publish_status import ApiPublishStatus from sentry.api.base import region_silo_endpoint from sentry.api.bases.group import GroupEndpoint -from sentry.issues.related import find_related_issues # To be deprecated from sentry.issues.related import RELATED_ISSUES_ALGORITHMS from sentry.models.group import Group from sentry.types.ratelimit import RateLimit, RateLimitCategory @@ -35,13 +34,6 @@ def get(self, request: Request, group: Group) -> Response: :pparam Group group: the group object """ # The type of related issues to retrieve. Can be either `same_root_cause` or `trace_connected`. - related_type = request.query_params.get("type") - related_issues: list[dict[str, str | list[int] | dict[str, str]]] = [] - - if related_type in RELATED_ISSUES_ALGORITHMS: - data, meta = RELATED_ISSUES_ALGORITHMS[related_type](group) - return Response({"type": related_type, "data": data, "meta": meta}) - else: - # XXX: We will be deprecating this approach soon - related_issues = find_related_issues(group) - return Response({"data": [related_set for related_set in related_issues]}) + related_type = request.query_params["type"] + data, meta = RELATED_ISSUES_ALGORITHMS[related_type](group) + return Response({"type": related_type, "data": data, "meta": meta}) diff --git a/src/sentry/issues/related/__init__.py b/src/sentry/issues/related/__init__.py index c5771783e68973..51d26537e00d66 100644 --- a/src/sentry/issues/related/__init__.py +++ b/src/sentry/issues/related/__init__.py @@ -1,7 +1,5 @@ """This module exports a function to find related issues. It groups them by type.""" -from sentry.models.group import Group - from .same_root_cause import same_root_cause_analysis from .trace_connected import trace_connected_analysis @@ -11,12 +9,3 @@ "same_root_cause": same_root_cause_analysis, "trace_connected": trace_connected_analysis, } - - -def find_related_issues(group: Group) -> list[dict[str, str | list[int] | dict[str, str]]]: - related_issues: list[dict[str, str | list[int] | dict[str, str]]] = [] - for key, func in RELATED_ISSUES_ALGORITHMS.items(): - data, meta = func(group) - related_issues.append({"type": key, "data": data, "meta": meta}) - - return related_issues