Skip to content

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

Open
wedamija wants to merge 1 commit into
danf/nestjs-cron-configfrom
danf/nestjs-cron-auto-monitor
Open

wedamija wants to merge 1 commit 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

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.44 kB - -
@sentry/browser - with treeshaking flags 27.59 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.48 kB - -
@sentry/browser (incl. Tracing) 51.32 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.33 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.31 kB - -
@sentry/browser (incl. Tracing, Replay) 90.95 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.93 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.65 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.65 kB - -
@sentry/browser (incl. Feedback) 46.96 kB - -
@sentry/browser (incl. sendFeedback) 34.5 kB - -
@sentry/browser (incl. FeedbackAsync) 39.6 kB - -
@sentry/browser (incl. Metrics) 30.45 kB - -
@sentry/browser (incl. Logs) 30.74 kB - -
@sentry/browser (incl. Metrics & Logs) 31.39 kB - -
@sentry/react 31.28 kB - -
@sentry/react (incl. Tracing) 53.69 kB - -
@sentry/vue 37.41 kB - -
@sentry/vue (incl. Tracing) 54.23 kB - -
@sentry/svelte 29.47 kB - -
@sentry/remix (Remix 3 client bundle) 55.65 kB - -
CDN Bundle 31.13 kB - -
CDN Bundle (incl. Tracing) 51.87 kB - -
CDN Bundle (incl. Logs, Metrics) 33.37 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 53.81 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.1 kB - -
CDN Bundle (incl. Tracing, Replay) 89.45 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.42 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.59 kB - -
CDN Bundle - uncompressed 91.95 kB - -
CDN Bundle (incl. Tracing) - uncompressed 154.26 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 98.53 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.21 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.15 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.06 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.77 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 293.69 kB - -
@sentry/nextjs (client) 56.18 kB - -
@sentry/sveltekit (client) 51.74 kB - -
@sentry/core/server 40.5 kB - -
@sentry/core/browser 13.51 kB - -
@sentry/node 144.64 kB +0.01% +11 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.22 kB - -
@sentry/node - without tracing 93.21 kB +0.02% +14 B 🔺
@sentry/node - without channel injection 122.85 kB +0.01% +7 B 🔺
@sentry/aws-serverless 101.46 kB +0.01% +8 B 🔺
@sentry/cloudflare (withSentry) - minified 208.47 kB - -
@sentry/cloudflare (withSentry) 516.75 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.

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 34f02f1. Configure here.

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

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