-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
chore(assignment): Add analytics when autoassigning after a manual assignment #45099
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,10 +7,11 @@ | |
| from sentry import features | ||
| from sentry.db.models import Model, region_silo_only_model, sane_repr | ||
| from sentry.db.models.fields import FlexibleForeignKey, JSONField | ||
| from sentry.models import ActorTuple | ||
| from sentry.models import Activity, ActorTuple | ||
| from sentry.models.groupowner import OwnerRuleType | ||
| from sentry.models.project import Project | ||
| from sentry.ownership.grammar import Rule, load_schema, resolve_actors | ||
| from sentry.types.activity import ActivityType | ||
| from sentry.utils import metrics | ||
| from sentry.utils.cache import cache | ||
|
|
||
|
|
@@ -287,6 +288,19 @@ def handle_auto_assignment(cls, project_id, event): | |
| } | ||
| ) | ||
|
|
||
| activity = Activity.objects.filter( | ||
| group=event.group, type=ActivityType.ASSIGNED.value | ||
| ).order_by("-datetime") | ||
| if activity: | ||
| auto_assigned = activity[0].data.get("integration") | ||
| if not auto_assigned: | ||
| analytics.record( | ||
| "autoassignment.post_manual_assignment", | ||
| organization_id=event.group.project.organization_id, | ||
| project_id=project_id, | ||
| group_id=event.group.id, | ||
| ) | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking about just returning early here now - initially I thought we'd gather metrics first and then stop auto-assigning when it's already been manually assigned, but we can still gather metrics for when we would have done it.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be ok with this too
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'll just merge this for now and go back tomorrow to return early and write a test 😎 |
||
| assignment = GroupAssignee.objects.assign( | ||
| event.group, | ||
| owner, | ||
|
|
||
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.
Idk much about the autoassignment feature, this was tricky to figure out so I hope it's right 😬 if it's not please point me towards how I can determine if an issue already has a manual assignment.