Skip to content

Commit 7dde859

Browse files
evanpurkhiserandrewshie-sentry
authored andcommitted
ref(uptime): Stop writing uptime_status on ProjectUptimeSubscription (#90775)
We'll drop this column in the future.
1 parent ff71c39 commit 7dde859

File tree

2 files changed

+7
-28
lines changed

2 files changed

+7
-28
lines changed

src/sentry/uptime/consumers/results_consumer.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -353,16 +353,9 @@ def handle_active_result(
353353
**result,
354354
},
355355
)
356-
# TODO(epurkhiser): Dual until we're only reading the uptime_status
357-
# from the uptime_subscription.
358-
now = django_timezone.now()
359-
project_subscription.update(
360-
uptime_status=UptimeStatus.FAILED,
361-
uptime_status_update_date=now,
362-
)
363356
project_subscription.uptime_subscription.update(
364357
uptime_status=UptimeStatus.FAILED,
365-
uptime_status_update_date=now,
358+
uptime_status_update_date=django_timezone.now(),
366359
)
367360
elif uptime_status == UptimeStatus.FAILED and result_status == CHECKSTATUS_SUCCESS:
368361
if not has_reached_status_threshold(project_subscription, result_status, metric_tags):
@@ -385,16 +378,9 @@ def handle_active_result(
385378
**result,
386379
},
387380
)
388-
# TODO(epurkhiser): Dual until we're only reading the uptime_status
389-
# from the uptime_subscription.
390-
now = django_timezone.now()
391-
project_subscription.update(
392-
uptime_status=UptimeStatus.OK,
393-
uptime_status_update_date=now,
394-
)
395381
project_subscription.uptime_subscription.update(
396382
uptime_status=UptimeStatus.OK,
397-
uptime_status_update_date=now,
383+
uptime_status_update_date=django_timezone.now(),
398384
)
399385

400386

src/sentry/uptime/subscriptions/subscriptions.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ def create_project_uptime_subscription(
231231
name=name,
232232
owner_user_id=owner_user_id,
233233
owner_team_id=owner_team_id,
234-
uptime_status=uptime_status,
235234
)
236235
detector = create_detector_from_project_subscription(uptime_monitor)
237236

@@ -354,17 +353,11 @@ def disable_uptime_detector(detector: Detector):
354353
# Resolve the issue so that we don't see it in the ui anymore
355354
resolve_uptime_issue(uptime_monitor)
356355

357-
uptime_monitor.update(
358-
status=ObjectStatus.DISABLED,
359-
# We set the status back to ok here so that if we re-enable we'll start
360-
# from a good state
361-
uptime_status=UptimeStatus.OK,
362-
)
363-
uptime_subscription.update(
364-
# We set the status back to ok here so that if we re-enable we'll start
365-
# from a good state
366-
uptime_status=UptimeStatus.OK
367-
)
356+
# We set the status back to ok here so that if we re-enable we'll start
357+
# from a good state
358+
uptime_subscription.update(uptime_status=UptimeStatus.OK)
359+
360+
uptime_monitor.update(status=ObjectStatus.DISABLED)
368361
detector.update(enabled=False)
369362

370363
quotas.backend.remove_seat(DataCategory.UPTIME, uptime_monitor)

0 commit comments

Comments
 (0)