Skip to content

feat(node): Add Crons check-ins for BullMQ job schedulers - #25472

Draft
wedamija wants to merge 2 commits into
developfrom
danf/bullmq-cron-monitors
Draft

wedamija wants to merge 2 commits into
developfrom
danf/bullmq-cron-monitors

Conversation

@wedamija

@wedamija wedamija commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Part of a series adding automatic Crons monitoring for the most-used job schedulers in each SDK. Check-ins for a monitor that doesn't exist yet are dropped, so today each monitor has to be created by hand with its schedule copied from the code. Sending the job's schedule as the monitor config lets Sentry create the monitor and keep it in sync.

This adds Sentry.cron.instrumentBullMQWorker, next to the existing cron, node-cron and node-schedule helpers. It listens to the worker's active, completed and failed events, so it also covers sandboxed (file) processors and never wraps or changes the processor. Every job that comes from a job scheduler gets in-progress and ok/error check-ins. The slug is the job scheduler id (job.repeatJobKey), not the job id.

const worker = new Worker('reports', processor, { connection });
Sentry.cron.instrumentBullMQWorker(worker, {
  excludeJobSchedulers: ['cache-warmup', /^tmp-/],
});

pattern is sent as a crontab with tz (or the server's time zone, which is what cron-parser uses without tz), and every as an interval when it's a whole number of minutes. Check-ins go out without a config for sub-minute schedules, ?/W/H syntax, both day fields set in a way Sentry reads differently from cron-parser, fixed UTC offsets, and schedulers with limit or endDate (they'd show as missed once they stop). Every accepted pattern shape was checked against cronsim for next-run dates with cron-parser 4 (BullMQ 5) and 5 (BullMQ 6). Legacy repeatable jobs (queue.add with repeat, removed in BullMQ 6) are keyed by a hash, so they aren't monitored.

Docs: getsentry/sentry-docs#20053

`Sentry.cron.instrumentBullMQWorker(worker)` sends check-ins for every job
the worker runs from a job scheduler, using the scheduler id as the monitor
slug and its `pattern` or `every` as the monitor schedule.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant