Skip to content

feat(crons): Use timeout_at for timed out check-ins #52570

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

Merged
merged 6 commits into from
Jul 17, 2023

Conversation

rjo100
Copy link
Contributor

@rjo100 rjo100 commented Jul 10, 2023

Queries off of timestamp of timeout_at for in progress check-ins

Closes #52563

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 10, 2023
@rjo100 rjo100 marked this pull request as ready for review July 11, 2023 16:02
@rjo100 rjo100 requested a review from a team as a code owner July 11, 2023 16:02
"monitor", "monitor_environment"
)[:CHECKINS_LIMIT]
qs = MonitorCheckIn.objects.filter(
status=CheckInStatus.IN_PROGRESS, timeout_at__lte=current_datetime
Copy link
Contributor Author

Choose a reason for hiding this comment

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

would it be worth changing the query to
Q(timeout_at__lte=current_datetime) | Q(timeout_at=None)
as a safety precaution? we don't have any null values currently but would be a good protection in case there's a regression so we don't ignore the null timeouts. could also put it in a separate query

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm. Maybe we can add a metric that we put an alert on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll run a query and raise an exception at the bottom as a safety check

@codecov
Copy link

codecov bot commented Jul 11, 2023

Codecov Report

Merging #52570 (73b21d7) into master (e558a85) will decrease coverage by 1.64%.
The diff coverage is 50.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #52570      +/-   ##
==========================================
- Coverage   79.46%   77.82%   -1.64%     
==========================================
  Files        4936     4938       +2     
  Lines      207430   207943     +513     
  Branches    35425    35499      +74     
==========================================
- Hits       164834   161835    -2999     
- Misses      37559    41027    +3468     
- Partials     5037     5081      +44     
Impacted Files Coverage Δ
src/sentry/monitors/tasks.py 86.95% <50.00%> (-4.54%) ⬇️

... and 523 files with indirect coverage changes

Copy link
Member

@evanpurkhiser evanpurkhiser left a comment

Choose a reason for hiding this comment

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

Looks like a great change to me

@rjo100 rjo100 merged commit 1dd3476 into master Jul 17, 2023
@rjo100 rjo100 deleted the rjo100/use-timeoutat-checkins branch July 17, 2023 20:54
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 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.

Update the task to query on timeout_at instead of looking for all in progress checkins.
2 participants