Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate(related_issues): Drop support for doing all types of related issues #70606

Merged
merged 2 commits into from
May 13, 2024
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
14 changes: 3 additions & 11 deletions src/sentry/api/endpoints/issues/related_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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})
11 changes: 0 additions & 11 deletions src/sentry/issues/related/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Loading