Skip to content

Commit b8a12ef

Browse files
feat(crons): Add crons.use_clock_pulse_consumer option (#69531)
This will control producing clock pulse messages into a kafka topic instead of dispatching to celery
1 parent f1111ec commit b8a12ef

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/sentry/monitors/clock_dispatch.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sentry_sdk
77
from django.conf import settings
88

9+
from sentry import options
910
from sentry.monitors.tasks.check_missed import check_missing
1011
from sentry.monitors.tasks.check_timeout import check_timeout
1112
from sentry.utils import metrics, redis
@@ -41,8 +42,13 @@ def _dispatch_tick(ts: datetime):
4142
sentry.io, when we deploy we restart the celery beat worker and it will
4243
skip any tasks it missed)
4344
"""
44-
check_missing.delay(current_datetime=ts)
45-
check_timeout.delay(current_datetime=ts)
45+
if options.get("crons.use_clock_pulse_consumer"):
46+
# TODO(epurkhiser): This should dispatch the pulse as a message on the
47+
# monitors-clock-pulse topic
48+
pass
49+
else:
50+
check_missing.delay(current_datetime=ts)
51+
check_timeout.delay(current_datetime=ts)
4652

4753

4854
def try_monitor_clock_tick(ts: datetime, partition: int):

src/sentry/options/defaults.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,14 @@
18201820
# Killswitch for monitor check-ins
18211821
register("crons.organization.disable-check-in", type=Sequence, default=[])
18221822

1823+
# Controls the method of clock task dispatch. This is part of GH-58410 and will
1824+
# enable dispatching via the clock pulse consumer instead of using celery tassk
1825+
register(
1826+
"crons.use_clock_pulse_consumer",
1827+
default=False,
1828+
flags=FLAG_MODIFIABLE_BOOL | FLAG_AUTOMATOR_MODIFIABLE,
1829+
)
1830+
18231831
# Turns on and off the running for dynamic sampling collect_orgs.
18241832
register("dynamic-sampling.tasks.collect_orgs", default=False, flags=FLAG_MODIFIABLE_BOOL)
18251833

0 commit comments

Comments
 (0)