Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/sentry/tasks/post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,10 @@ def detect_new_escalation(job: PostProcessJob):
job.
"""
from sentry.issues.issue_velocity import get_latest_threshold
from sentry.models.activity import Activity
from sentry.models.grouphistory import GroupHistoryStatus, record_group_history
from sentry.models.groupinbox import GroupInboxReason, add_group_to_inbox
from sentry.types.activity import ActivityType

group = job["event"].group
if not group or not features.has(
Expand All @@ -1382,7 +1385,15 @@ def detect_new_escalation(job: PostProcessJob):
if project_escalation_rate > 0 and group_hourly_event_rate > project_escalation_rate:
job["has_escalated"] = True
group.update(substatus=GroupSubStatus.ESCALATING)

# TODO(snigdha): reuse manage_issue_states when we allow escalating from other statuses
add_group_to_inbox(group, GroupInboxReason.ESCALATING)
record_group_history(group, GroupHistoryStatus.ESCALATING)
Activity.objects.create_group_activity(
group=group,
type=ActivityType.SET_ESCALATING,
data={"event_id": job["event"].event_id},
)
except UnableToAcquireLock as error:
extra["error"] = error
logger.warning(
Expand Down