-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
feat(related_issues): API to find groups caused by the same root error #66992
Conversation
…or type and title This is core of the work. To-do: * Create related-issues API * Create feature flag
|
||
def match_criteria(a: dict[str, str | None], b: dict[str, str | None]) -> bool: | ||
# XXX: In future iterations we will be able to use similar titles rather than an exact match | ||
return a["type"] == b["type"] and a["title"] == b["title"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very simplistic but it works in a lot of cases.
def test_same_root_related_issues(self) -> None: | ||
# This is the group we're going to query about | ||
group = self.create_group(data=self._data(self.error_type, self.error_value)) | ||
self.group_id = group.id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will allow reverse_url
to point to this specific group.
def same_root_cause_analysis(group: Group) -> list[Group]: | ||
"""Analyze and create a group set if the group was caused by the same root cause.""" | ||
# XXX: This function is not optimal since we can't query the data field which is a GzippedDictField | ||
project_groups = Group.objects.filter(project=group.project_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unbounded, you should use RangeQuerySetWrapper
here and also limit the number of groups returned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also probably be helpful to just fetch the fields you need rather than the entire Group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Thanks, Dan!
@@ -480,24 +480,24 @@ static/app/components/events/eventStatisticalDetector/ @getse | |||
|
|||
|
|||
## Issues | |||
**/issues/** @getsentry/issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches all paths that contain the issues directory. I've tested it.
@@ -480,24 +480,24 @@ static/app/components/events/eventStatisticalDetector/ @getse | |||
|
|||
|
|||
## Issues | |||
**/issues/** @getsentry/issues | |||
/src/sentry/api/helpers/source_map_helper.py @getsentry/issues | |||
/src/sentry/api/helpers/actionable_items_helper.py @getsentry/issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I make an explicit comment, I'm just re-ordering the list alphabetically.
/src/sentry/event_manager.py @getsentry/issues | ||
/src/sentry/grouping/ @getsentry/issues | ||
/src/sentry/issues/ @getsentry/issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing. It is now matched by the global matcher at the top.
/tests/sentry/event_manager/ @getsentry/issues | ||
/tests/sentry/grouping/ @getsentry/issues | ||
/tests/sentry/issues/ @getsentry/issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing. It is now matched by the global matcher at the top.
"""Analyze and create a group set if the group was caused by the same root cause.""" | ||
# Querying the data field (which is a GzippedDictField) cannot be done via | ||
# Django's ORM, thus, we do so via compare_groups | ||
project_groups = RangeQuerySetWrapper(Group.objects.filter(project=group.project_id), limit=100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've addressed Dan's concern and started using RangeQuerySetWrapper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're limiting to 100 rows total you don't need the ranged wrapper, the limit is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. This is not a permanent change. I will tweak it later.
"""Analyze and create a group set if the group was caused by the same root cause.""" | ||
# Querying the data field (which is a GzippedDictField) cannot be done via | ||
# Django's ORM, thus, we do so via compare_groups | ||
project_groups = RangeQuerySetWrapper(Group.objects.filter(project=group.project_id), limit=100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're limiting to 100 rows total you don't need the ranged wrapper, the limit is enough.
PR #66992 added an API to show related issues with the same error type and title. This change adds a Related Issues tab to the Issue Details page in order to show those related issues. This change is behind a feature flag while we polish it. Currently the list of related issues does not allow for taking actions but that will come in a following change.
…#67079) This PR depends on #66992 which adds the API to related issues. --------- Co-authored-by: Scott Cooper <[email protected]> Co-authored-by: Malachi Willey <[email protected]>
This adds an API which will return all groups that are related to an issue.
For now, it will only show groups that have the same error type and title. It will likely need more polishing as we look at real-life examples.
This also lays the ground for adding other heuristics like trace-connected errors.