Skip to content

feat(nestjs): Add an option to monitor every @Cron method - #25471

Open
wedamija wants to merge 7 commits into
danf/nestjs-cron-configfrom
danf/nestjs-cron-auto-monitor
Open

wedamija wants to merge 7 commits into
danf/nestjs-cron-configfrom
danf/nestjs-cron-auto-monitor

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.

Adds monitorCronJobs to nestIntegration. When it's on, every @Cron() method sends check-ins with the schedule and time zone from @Cron() as the monitor config, so apps don't need @SentryCron on each method. It is off by default. The slug is the @Cron() name, or ClassName.methodName without one.

Sentry.init({
  dsn: '...',
  integrations: [Sentry.nestIntegration({ monitorCronJobs: true, excludeCronJobs: ['cleanup', /^Dev/] })],
});

Methods that also have @SentryCron keep their slug and send one set of check-ins. Schedules Crons can't express, like every 10 seconds, check in without a config. It needs enableRuntimeChannelInjection, which is on by default.

Stacked on #25013.

`nestIntegration({ monitorCronJobs: true })` sends check-ins for every
`@Cron()` method, with the schedule from `@Cron()` as monitor config.
The slug is the `@Cron()` name, else `ClassName.methodName`.
`excludeCronJobs` skips jobs; methods with `@SentryCron` keep their slug.

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

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: bce952f (PR test merge using danf/nestjs-cron-config at a9a89d7)

Against: de10e52 (danf/nestjs-cron-config) · base run #64016

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

Path Size % Change Change
@sentry/browser 30.39 kB - -
@sentry/browser - with treeshaking flags 28.5 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.4 kB - -
@sentry/browser (incl. Tracing) 52.66 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.66 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.59 kB - -
@sentry/browser (incl. Tracing, Replay) 92.89 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.5 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.63 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.6 kB - -
@sentry/browser (incl. Feedback) 47.95 kB - -
@sentry/browser (incl. sendFeedback) 35.47 kB - -
@sentry/browser (incl. FeedbackAsync) 40.57 kB - -
@sentry/browser (incl. Metrics) 31.4 kB - -
@sentry/browser (incl. Logs) 31.68 kB - -
@sentry/browser (incl. Metrics & Logs) 32.36 kB - -
@sentry/react 32.2 kB - -
@sentry/react (incl. Tracing) 54.94 kB - -
@sentry/vue 38.67 kB - -
@sentry/vue (incl. Tracing) 55.55 kB - -
@sentry/svelte 30.42 kB - -
@sentry/remix (Remix 3 client bundle) 57.71 kB - -
CDN Bundle 32.11 kB - -
CDN Bundle (incl. Tracing) 53.14 kB - -
CDN Bundle (incl. Logs, Metrics) 34.31 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.09 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.76 kB - -
CDN Bundle (incl. Tracing, Replay) 91.3 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.26 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 97.44 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.44 kB - -
CDN Bundle - uncompressed 94.47 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.46 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.02 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.43 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.57 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 279.15 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.1 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 292.85 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 298.79 kB - -
@sentry/nextjs (client) 57.79 kB - -
@sentry/sveltekit (client) 53.11 kB - -
@sentry/core/server 44.34 kB - -
@sentry/core/browser 13.95 kB - -
@sentry/node 155.2 kB +0.07% +105 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.73 kB +0.08% +64 B 🔺
@sentry/node - without tracing 95.89 kB +0.08% +71 B 🔺
@sentry/node - without channel injection 135.77 kB +0.04% +49 B 🔺
@sentry/aws-serverless 104.06 kB +0.07% +71 B 🔺
@sentry/cloudflare (withSentry) - minified 198.09 kB - -
@sentry/cloudflare (withSentry) 492.11 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 218.68 kB - -

View base workflow run

@wedamija wedamija changed the title feat(nestjs): Add option to monitor every @Cron method feat(nestjs): Add an option to monitor every @Cron method Oct 20, 2026
@wedamija
wedamija marked this pull request as ready for review October 20, 2026 23:53
@wedamija
wedamija requested a review from a team as a code owner October 20, 2026 23:53
@wedamija
wedamija requested review from chargome and s1gr1d and removed request for a team October 20, 2026 23:53

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/nestjs/src/integrations/cron-monitoring.ts
@github-actions

Copy link
Copy Markdown
Contributor

👋 @chargome, @s1gr1d — Please review this PR when you get a chance!

@linear-code

linear-code Bot commented Oct 25, 2026

Copy link
Copy Markdown

JS-4000

@s1gr1d
s1gr1d requested a review from nicohrubec October 27, 2026 14:46
@nestjs/schedule runs @Cron methods as cron CronJobs, so with monitorCronJobs
and cronJobIntegration both on each run sent two sets of check-ins. Mark the
onTick Nest passes to CronJob when the method already sends check-ins.
@wedamija
wedamija requested a review from a team as a code owner October 28, 2026 19:20
@wedamija
wedamija requested review from andreiborza and isaacs and removed request for a team October 28, 2026 19:20

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/nestjs/src/integrations/orchestrion-subscriber.ts
…nf/nestjs-cron-auto-monitor

# Conflicts:
#	packages/nestjs/src/integrations/orchestrion-subscriber.ts
@wedamija
wedamija requested a review from a team as a code owner October 28, 2026 19:49
@wedamija
wedamija requested review from logaretm and msonnb and removed request for a team October 28, 2026 19:49
Key the monitored check on the @Cron() options metadata, which outer
decorators copy, so it doesn't depend on decorator order.
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 1 not successful, 61 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E node-anthropic-send-to-sentry (latest) Test (optional) Failing after 3m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (canary, webpack) Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (canary, turbopack) Test (optional) Successful in 4m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 32s Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (canary) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 22s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 17s Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-flue-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 20s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 28s Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-anthropic-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 24s Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (deno) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nextjs-16-standalone (canary, turbopack) Test (optional) Successful in 23s Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 22s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 18s Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 21s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 (tracer provider) Test (optional) Successful in 23s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-4 (canary) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-openai-send-to-sentry (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 23s Details
✅ CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions-send-to-sentry (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 27s Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-3 (canary) Test (optional) Successful in 57s Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E node-openai-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 20s Details
✅ CI: Optional E2E Tests / E2E node-flue-send-to-sentry (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-4-static (canary) Test (optional) Successful in 2m Details

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0c123c6. Configure here.

Comment thread packages/nestjs/src/integrations/cron-monitoring.ts
…t and @Cron()

Mark @SentryCron in metadata that outer decorators copy and on the @Cron()
options it wraps, so @Cron() monitoring skips it in any decorator order.
…-nest-auto

# Conflicts:
#	packages/nestjs/src/decorators.ts
#	packages/nestjs/src/integrations/helpers.ts
#	packages/nestjs/src/integrations/orchestrion-subscriber.ts

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