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

ref(related_issues): Minor code refactoring before feature work #69137

Merged
merged 2 commits into from
Apr 18, 2024

Conversation

armenzg
Copy link
Member

@armenzg armenzg commented Apr 17, 2024

Changes included:

  • Only return new data shape in the endpoint
  • Add rate limit to endpoint
  • More explicit typing
  • Return list of group IDs instead of groups

Changes included:

* Only return new data shape in endpoint
* Add rate limit to endpoint
* More explicit typing
* Return list of group IDs instead of groups
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 17, 2024
src/sentry/api/endpoints/issues/related_issues.py Outdated Show resolved Hide resolved
response: dict[str, Any] = {
related_set["type"]: [int(g.id) for g in related_set["data"]]
for related_set in related_issues
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We won't be returning this data shape. The UI only uses the new shape (#68985).

@@ -13,8 +11,8 @@
}


def find_related_issues(group: Group) -> list[dict[str, Any]]:
related_issues = []
def find_related_issues(group: Group) -> list[dict[str, list[int] | str]]:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little tighter than Any.

from sentry.models.group import Group
from sentry.utils.query import RangeQuerySetWrapper


def same_root_cause_analysis(group: Group) -> list[Group]:
def same_root_cause_analysis(group: Group) -> list[int]:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The endpoint is going to return the group IDs. This also makes typing a bit simpler in the module above.

@armenzg armenzg self-assigned this Apr 17, 2024
@armenzg armenzg marked this pull request as ready for review April 17, 2024 19:35
@armenzg armenzg requested a review from a team as a code owner April 17, 2024 19:35
@armenzg armenzg merged commit 160e695 into master Apr 18, 2024
48 checks passed
@armenzg armenzg deleted the ref/related_issues/armenzg branch April 18, 2024 12:41
@armenzg armenzg added this to the Related Issues - V1 milestone Apr 25, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants