def delete_old_group(project_id, group_id): from sentry.models.group import Group from sentry.group_deletion import delete_group group = Group.objects.get_from_cache(id=group_id) delete_group(group)
def delete(self, request, group): """ Remove an Issue ``````````````` Removes an individual issue. :pparam string issue_id: the ID of the issue to delete. :auth: required """ try: from sentry.utils import snuba from sentry.group_deletion import delete_group transaction_id = delete_group(group) if transaction_id: self.create_audit_entry( request=request, organization_id=group.project.organization_id if group.project else None, target_object=group.id, transaction_id=transaction_id, ) delete_logger.info( "object.delete.queued", extra={ "object_id": group.id, "transaction_id": transaction_id, "model": type(group).__name__, }, ) # This is exclusively used for analytics, as such it should not run as part of reprocessing. issue_deleted.send_robust( group=group, user=request.user, delete_type="delete", sender=self.__class__ ) metrics.incr( "group.update.http_response", sample_rate=1.0, tags={"status": 200, "detail": "group_details:delete:Reponse"}, ) return Response(status=202) except snuba.RateLimitExceeded: metrics.incr( "group.update.http_response", sample_rate=1.0, tags={"status": 429, "detail": "group_details:delete:snuba.RateLimitExceeded"}, ) raise except Exception: metrics.incr( "group.update.http_response", sample_rate=1.0, tags={"status": 500, "detail": "group_details:delete:Exception"}, ) raise