Просмотр исходного кода

fix(issues): Remove auto-resolve analytic in serializer (#53616)

Scott Cooper 1 год назад
Родитель
Сommit
2f4f0e5379

+ 2 - 11
src/sentry/api/serializers/models/group.py

@@ -26,7 +26,7 @@ import sentry_sdk
 from django.conf import settings
 from django.db.models import Min, prefetch_related_objects
 
-from sentry import analytics, tagstore
+from sentry import tagstore
 from sentry.api.serializers import Serializer, register, serialize
 from sentry.api.serializers.models.actor import ActorSerializer
 from sentry.api.serializers.models.plugin import is_plugin_deprecated
@@ -424,18 +424,9 @@ class GroupSerializerBase(Serializer, ABC):
             else:
                 status = GroupStatus.UNRESOLVED
         if status == GroupStatus.UNRESOLVED and obj.is_over_resolve_age():
+            # When an issue is over the auto-resolve age but the task has not yet run
             status = GroupStatus.RESOLVED
             status_details["autoResolved"] = True
-            analytics.record(
-                "issue.resolved",
-                default_user_id=obj.project.organization.get_default_owner().id,
-                project_id=obj.project.id,
-                organization_id=obj.project.organization_id,
-                group_id=obj.id,
-                resolution_type="automatic",
-                issue_type=obj.issue_type.slug,
-                issue_category=obj.issue_category.name.lower(),
-            )
         if status == GroupStatus.RESOLVED:
             status_label = "resolved"
             if attrs["resolution_type"] == "release":

+ 1 - 12
tests/snuba/api/serializers/test_group.py

@@ -142,9 +142,8 @@ class GroupSerializerSnubaTest(APITestCase, SnubaTestCase):
         assert result["status"] == "resolved"
         assert result["statusDetails"]["inCommit"]["id"] == commit.key
 
-    @mock.patch("sentry.analytics.record")
     @mock.patch("sentry.models.Group.is_over_resolve_age")
-    def test_auto_resolved(self, mock_is_over_resolve_age, mock_record):
+    def test_auto_resolved(self, mock_is_over_resolve_age):
         mock_is_over_resolve_age.return_value = True
 
         user = self.create_user()
@@ -153,16 +152,6 @@ class GroupSerializerSnubaTest(APITestCase, SnubaTestCase):
         result = serialize(group, user, serializer=GroupSerializerSnuba())
         assert result["status"] == "resolved"
         assert result["statusDetails"] == {"autoResolved": True}
-        mock_record.assert_called_with(
-            "issue.resolved",
-            default_user_id=self.project.organization.get_default_owner().id,
-            project_id=self.project.id,
-            organization_id=self.project.organization_id,
-            group_id=group.id,
-            resolution_type="automatic",
-            issue_type="error",
-            issue_category="error",
-        )
 
     def test_subscribed(self):
         user = self.create_user()