Skip to content

feat(node): Add bullmqJobSchedulerIntegration to monitor BullMQ job schedulers - #25472

Draft
wedamija wants to merge 28 commits into
danf/shared-cron-converterfrom
danf/bullmq-cron-monitors
Draft

wedamija wants to merge 28 commits into
danf/shared-cron-converterfrom
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 bullmqJobSchedulerIntegration, which sends check-ins for the jobs every BullMQ worker (5.16.0 to 6.x) runs from a job scheduler, with <queue>-<scheduler id> as the monitor slug and the scheduler's pattern or every as the schedule. Adding the integration is the opt-in, so no per-worker call is needed; schedulers Crons can't express aren't monitored, and a retried job keeps one check-in.

Sentry.init({
  dsn: '...',
  integrations: [Sentry.bullmqJobSchedulerIntegration({ excludeJobSchedulers: ['cache-warmup', /^tmp-/] })],
});

BullMQ is only in the runtime instrumentation list: the bundler plugins force listed packages into the bundle, where BullMQ can't find the files it starts sandboxed processors from. That also means bun run can't instrument it, so @sentry/bun doesn't export the integration.

Stacked on #25918.

Docs: getsentry/sentry-docs#20053

wedamija and others added 2 commits October 19, 2026 17:44
`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>
@wedamija
wedamija force-pushed the danf/bullmq-cron-monitors branch from dd87bd3 to b7b621e Compare October 20, 2026 00:51
Co-Authored-By: Claude <noreply@anthropic.com>
@wedamija wedamija changed the title feat(node): Add Crons check-ins for BullMQ job schedulers feat(node): Add Crons monitoring for BullMQ job schedulers Oct 20, 2026
Co-Authored-By: Claude <noreply@anthropic.com>
@linear-code

linear-code Bot commented Oct 25, 2026

Copy link
Copy Markdown

JS-4001

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: de48a2b (PR test merge using danf/shared-cron-converter at 28da7c9)

Against: c491307 (danf/shared-cron-converter) · base run #65764

⚠️ Baseline mismatch: 17 danf/shared-cron-converter commit(s) in the PR build are missing from the baseline. Their size changes also affect this comparison. Compare commits. Re-run once danf/shared-cron-converter's baseline build for 28da7c9 finishes.

Path Size % Change Change
@sentry/browser 30.04 kB - -
@sentry/browser - with treeshaking flags 28.23 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.14 kB - -
@sentry/browser (incl. Tracing) 52.21 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.22 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.17 kB - -
@sentry/browser (incl. Tracing, Replay) 92.75 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.5 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.1 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.52 kB - -
@sentry/browser (incl. Feedback) 47.66 kB - -
@sentry/browser (incl. sendFeedback) 30.61 kB - -
@sentry/browser (incl. FeedbackAsync) 35.63 kB - -
@sentry/browser (incl. Metrics) 31.36 kB - -
@sentry/browser (incl. Logs) 31.63 kB - -
@sentry/browser (incl. Metrics & Logs) 32.29 kB - -
@sentry/react 32.04 kB - -
@sentry/react (incl. Tracing) 54.84 kB - -
@sentry/vue 38.2 kB - -
@sentry/vue (incl. Tracing) 55.12 kB - -
@sentry/svelte 30.06 kB - -
@sentry/remix (Remix 3 client bundle) 57.93 kB - -
CDN Bundle 31.8 kB - -
CDN Bundle (incl. Tracing) 52.55 kB - -
CDN Bundle (incl. Logs, Metrics) 34.58 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.1 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.62 kB - -
CDN Bundle (incl. Tracing, Replay) 90.6 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.22 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.01 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.61 kB - -
CDN Bundle - uncompressed 92.67 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.11 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.01 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 162.75 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.09 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.26 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 282.89 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.05 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 294.68 kB - -
@sentry/nextjs (client) 58.23 kB - -
@sentry/sveltekit (client) 53.24 kB - -
@sentry/core/server 44.52 kB - -
@sentry/core/browser 13.99 kB - -
@sentry/node 149.3 kB +0.08% +115 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.26 kB +0.13% +100 B 🔺
@sentry/node - without tracing 88.34 kB +0.12% +98 B 🔺
@sentry/node - without channel injection 138.27 kB +0.08% +101 B 🔺
@sentry/aws-serverless 97.19 kB +0.09% +84 B 🔺
@sentry/cloudflare (withSentry) - minified 204.16 kB - -
@sentry/cloudflare (withSentry) 473.86 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 229.47 kB - -

View base workflow run

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 4 not successful, 51 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Failing after 2m Details
❌ CI: Optional E2E Tests / E2E nextjs-16-cacheComponents (cloudflare) Test (optional) Failing after 10m Details
❌ CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) Failing after 50s Details
❌ CI: Optional E2E Tests / E2E node-eve Test (optional) Failing after 2m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 52s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) Successful in 53s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 29s Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) Successful in 50s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 58s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (tunnel-dev) Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 39s Details

wedamija and others added 10 commits October 26, 2026 12:49
# Conflicts:
#	dev-packages/node-integration-tests/package.json
#	pnpm-lock.yaml
The BullMQ tracing suite from develop also binds 6384.
With BullMQTelemetry, the worker emits `active` before the job's process span
starts, so the in_progress check-in linked to the previous job's trace. Sentry
keeps that trace for the check-in. Send it from the processor instead, and add
an integration test that runs a job scheduler with both enabled.
instrumentBullMQWorker only monitors job schedulers whose schedule Sentry
can represent.
…onitors

# Conflicts:
#	packages/node/src/cron/index.ts
BullMQ emits `failed` for every attempt, so a retried job sent an error
check-in and then opened a second in_progress. The check-in id now comes from
the job, so retries and reruns of stalled jobs update the first attempt's
check-in, even on another worker, and only the last failure sends an error.

Also skips `pattern` schedules when the worker has a custom repeat strategy.

Co-Authored-By: Claude <noreply@anthropic.com>
… danf/bullmq-cron-monitors

# Conflicts:
#	CHANGELOG.md
BullMQ patterns go through `getCronMonitorConfig` with the `cron-parser`
dialect, like `node-schedule`. The monitor slug is `<queue>-<scheduler id>`,
since scheduler ids are only unique within a queue.

Co-Authored-By: Claude <noreply@anthropic.com>
@wedamija
wedamija changed the base branch from develop to danf/shared-cron-converter November 11, 2026 19:09
wedamija and others added 2 commits November 11, 2026 11:18
…egration

Adding the integration is the opt-in, and it monitors every BullMQ Worker
without a per-worker call. It lives in server-utils next to the other cron
integrations and hooks the Worker constructor through the runtime
diagnostics-channel injection, in CJS and ESM.

BullMQ is only in the runtime instrumentation list. In the bundler list,
the plugins would force it into bundles, where it can't find the files it
starts sandboxed processors from.

Co-Authored-By: Claude <noreply@anthropic.com>
@wedamija wedamija changed the title feat(node): Add Crons monitoring for BullMQ job schedulers feat(node): Add bullmqJobSchedulerIntegration to monitor BullMQ job schedulers Nov 11, 2026
wedamija and others added 5 commits November 11, 2026 12:10
Co-Authored-By: Claude <noreply@anthropic.com>
Frameworks pass this list to their keep-external option, so BullMQ loads
through Node's loader, where the runtime hook instruments it.

Co-Authored-By: Claude <noreply@anthropic.com>
`bun run` can't inject the worker channel, and the bundler plugins don't
instrument BullMQ, so the integration would never send a check-in on Bun.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BullMQ 6 is npm latest and uses cron-parser 5, which reads the converted
expressions like cron-parser 4 (fuzzed against cronsim) but ignores `utc`
and `nthDayOfWeek`. BullMQ 5 reads `nthDayOfWeek` like `#n`, so it's
sent that way when that's exact and skipped otherwise.

Legacy repeatable jobs are told apart from job schedulers by `repeat.key`
or by their key matching the name and repeat options, so scheduler ids that
look like hashes or have colons are monitored. The reason a scheduler isn't
monitored is logged once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wedamija and others added 6 commits November 11, 2026 15:55
…iber

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ribers get unknown

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…common key hashes

A queue's repeatKeyHashAlgorithm isn't reachable from the worker, so legacy
keys hashed with md5, sha1, sha256 or sha512 are recognized too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s logging

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…meout

Co-Authored-By: Claude Opus 5.5 <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