Skip to content
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(severity): Use new escalation logic for archived issues <1 day old #61396

Merged
merged 6 commits into from
Dec 8, 2023

Conversation

isabellaenriquez
Copy link
Member

@isabellaenriquez isabellaenriquez commented Dec 7, 2023

This PR updates archived -> escalating issues so that if they are less than a day old, they use the new escalation logic, otherwise they use the existing logic.

This PR also changes the new escalation logic tests to use timezone instead of datetime since first_seen on Group is timezone-aware.

Resolves #60418

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 7, 2023
@@ -1367,7 +1378,10 @@ def detect_new_escalation(job: PostProcessJob):
):
return
group_age_hours = (datetime.now() - group.first_seen).total_seconds() / 3600
if group_age_hours >= MAX_NEW_ESCALATION_AGE_HOURS or group.substatus != GroupSubStatus.NEW:
has_valid_status = group.substatus == GroupSubStatus.NEW or (
group.status == GroupStatus.IGNORED and group.substatus == GroupSubStatus.UNTIL_ESCALATING
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rn there aren't cases where we'd have GroupSubStatus.UNTIL_ESCALATING without GroupStatus.IGNORED but i thought it was worth checking for status any way in case we decided to use the substatus for other things

Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Merging #61396 (fc6dc04) into master (a825290) will increase coverage by 0.00%.
Report is 2 commits behind head on master.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #61396   +/-   ##
=======================================
  Coverage   81.12%   81.12%           
=======================================
  Files        5191     5191           
  Lines      227915   227919    +4     
  Branches    38225    38225           
=======================================
+ Hits       184889   184896    +7     
+ Misses      37411    37410    -1     
+ Partials     5615     5613    -2     
Files Coverage Δ
src/sentry/tasks/post_process.py 87.59% <100.00%> (-0.39%) ⬇️

... and 3 files with indirect coverage changes

@isabellaenriquez isabellaenriquez marked this pull request as ready for review December 7, 2023 23:35
@isabellaenriquez isabellaenriquez requested a review from a team as a code owner December 7, 2023 23:35
@@ -1366,8 +1374,11 @@ def detect_new_escalation(job: PostProcessJob):
"projects:first-event-severity-new-escalation", job["event"].project
):
return
group_age_hours = (datetime.now() - group.first_seen).total_seconds() / 3600
if group_age_hours >= MAX_NEW_ESCALATION_AGE_HOURS or group.substatus != GroupSubStatus.NEW:
group_age_hours = (timezone.now() - group.first_seen).total_seconds() / 3600
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think datetime.now() originally worked because our test data had first_seen set with a datetime, but based on the table schema it seems like we save groups with timezone info?

src/sentry/tasks/post_process.py Show resolved Hide resolved
src/sentry/tasks/post_process.py Show resolved Hide resolved
@isabellaenriquez isabellaenriquez merged commit d2f369c into master Dec 8, 2023
50 checks passed
@isabellaenriquez isabellaenriquez deleted the isabella/new-escalation-archived branch December 8, 2023 17:27
@github-actions github-actions bot locked and limited conversation to collaborators Dec 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply the new issue escalation logic to archived until escalating
3 participants