Skip to content

Commit c979bc1

Browse files
authored
Revert "debug(crons): Add kwargs to mark_checkin_timeout" (#59327)
This reverts commit 0315c29. Not needed anymore as we have a handle on the bug.
1 parent 12e966a commit c979bc1

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

src/sentry/monitors/tasks.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,15 +338,7 @@ def check_timeout(current_datetime: datetime):
338338
metrics.gauge("sentry.monitors.tasks.check_timeout.count", qs.count(), sample_rate=1)
339339
# check for any monitors which are still running and have exceeded their maximum runtime
340340
for checkin in qs:
341-
# used for temporary debugging
342-
kwargs = {
343-
"monitor_id": checkin.monitor.id,
344-
"monitor_environment_id": checkin.monitor_environment.id,
345-
"status": checkin.status,
346-
"date_added": checkin.date_added,
347-
"timeout_at": checkin.timeout_at,
348-
}
349-
mark_checkin_timeout.delay(checkin.id, current_datetime, **kwargs)
341+
mark_checkin_timeout.delay(checkin.id, current_datetime)
350342

351343

352344
@instrumented_task(

tests/sentry/monitors/test_tasks.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@ def make_ref_time(**kwargs):
6262
return task_run_ts, sub_task_run_ts, trimmed_ts
6363

6464

65-
def get_checkin_timeout_kwargs(checkin: MonitorCheckIn):
66-
return {
67-
"monitor_id": checkin.monitor.id,
68-
"monitor_environment_id": checkin.monitor_environment.id,
69-
"status": checkin.status,
70-
"date_added": checkin.date_added,
71-
"timeout_at": checkin.timeout_at,
72-
}
73-
74-
7565
class MonitorTaskCheckMissingTest(TestCase):
7666
@mock.patch("sentry.monitors.tasks.mark_environment_missing")
7767
def test_missing_checkin(self, mark_environment_missing_mock):
@@ -662,18 +652,15 @@ def test_timeout(self, mark_checkin_timeout_mock):
662652
assert mark_checkin_timeout_mock.delay.call_count == 0
663653

664654
# Timout at 12:30
665-
checkin_kwargs = get_checkin_timeout_kwargs(checkin)
666655
check_timeout(task_run_ts + timedelta(minutes=30))
667656
assert mark_checkin_timeout_mock.delay.call_count == 1
668657
assert mark_checkin_timeout_mock.delay.mock_calls[0] == mock.call(
669658
checkin.id,
670659
sub_task_run_ts + timedelta(minutes=30),
671-
**checkin_kwargs,
672660
)
673661
mark_checkin_timeout(
674662
checkin.id,
675663
sub_task_run_ts + timedelta(minutes=30),
676-
**checkin_kwargs,
677664
)
678665

679666
# Check in is marked as timed out
@@ -757,19 +744,16 @@ def test_timeout_with_overlapping_concurrent_checkins(self, mark_checkin_timeout
757744
assert mark_checkin_timeout_mock.delay.call_count == 0
758745

759746
# First checkin timed out
760-
checkin_kwargs = get_checkin_timeout_kwargs(checkin1)
761747
check_timeout(task_run_ts + timedelta(minutes=30))
762748
assert mark_checkin_timeout_mock.delay.call_count == 1
763749
assert mark_checkin_timeout_mock.delay.mock_calls[0] == mock.call(
764750
checkin1.id,
765751
sub_task_run_ts + timedelta(minutes=30),
766-
**checkin_kwargs,
767752
)
768753

769754
mark_checkin_timeout(
770755
checkin1.id,
771756
sub_task_run_ts + timedelta(minutes=30),
772-
**checkin_kwargs,
773757
)
774758

775759
# First checkin is marked as timed out
@@ -835,15 +819,13 @@ def test_timeout_at_next_checkin_time(self, mark_checkin_timeout_mock):
835819
)
836820

837821
# Check in was marked as timed out
838-
checkin_kwargs = get_checkin_timeout_kwargs(checkin)
839822
check_timeout(task_run_ts)
840823
assert mark_checkin_timeout_mock.delay.call_count == 1
841824
assert mark_checkin_timeout_mock.delay.mock_calls[0] == mock.call(
842825
checkin.id,
843826
sub_task_run_ts,
844-
**checkin_kwargs,
845827
)
846-
mark_checkin_timeout(checkin.id, sub_task_run_ts, **checkin_kwargs)
828+
mark_checkin_timeout(checkin.id, sub_task_run_ts)
847829

848830
# First checkin is marked as timed out
849831
assert MonitorCheckIn.objects.filter(id=checkin.id, status=CheckInStatus.TIMEOUT).exists()
@@ -897,18 +879,15 @@ def test_timeout_using_interval(self, mark_checkin_timeout_mock):
897879
)
898880

899881
# Timout at 12:05
900-
checkin_kwargs = get_checkin_timeout_kwargs(checkin)
901882
check_timeout(task_run_ts + timedelta(minutes=5))
902883
assert mark_checkin_timeout_mock.delay.call_count == 1
903884
assert mark_checkin_timeout_mock.delay.mock_calls[0] == mock.call(
904885
checkin.id,
905886
sub_task_run_ts + timedelta(minutes=5),
906-
**checkin_kwargs,
907887
)
908888
mark_checkin_timeout(
909889
checkin.id,
910890
sub_task_run_ts + timedelta(minutes=5),
911-
**checkin_kwargs,
912891
)
913892

914893
# Check in is marked as timed out
@@ -979,18 +958,16 @@ def test_timeout_with_future_complete_checkin(self, mark_checkin_timeout_mock):
979958

980959
# Running check monitor will mark the first checkin as timed out. The
981960
# second checkin was already marked as OK.
982-
checkin_kwargs = get_checkin_timeout_kwargs(checkin1)
983961
check_timeout(task_run_ts)
984962

985963
# assert that task is called for the specific checkin
986964
assert mark_checkin_timeout_mock.delay.call_count == 1
987965
assert mark_checkin_timeout_mock.delay.mock_calls[0] == mock.call(
988966
checkin1.id,
989967
sub_task_run_ts,
990-
**checkin_kwargs,
991968
)
992969

993-
mark_checkin_timeout(checkin1.id, sub_task_run_ts, **checkin_kwargs)
970+
mark_checkin_timeout(checkin1.id, sub_task_run_ts)
994971

995972
# The first checkin is marked as timed out
996973
assert MonitorCheckIn.objects.filter(id=checkin1.id, status=CheckInStatus.TIMEOUT).exists()

0 commit comments

Comments
 (0)