From f28caacba89fcb9152e9383e234b66495d7fdff0 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Fri, 16 Oct 2026 17:55:32 -0700 Subject: [PATCH 1/2] docs(js): Document nodeScheduleIntegration for Crons Co-Authored-By: Claude --- ...-crons-automatic-crons-instrumentation.mdx | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/includes/javascript-crons-automatic-crons-instrumentation.mdx b/includes/javascript-crons-automatic-crons-instrumentation.mdx index c9d7f216ebca4..52e2d31440368 100644 --- a/includes/javascript-crons-automatic-crons-instrumentation.mdx +++ b/includes/javascript-crons-automatic-crons-instrumentation.mdx @@ -94,3 +94,34 @@ scheduleWithCheckIn.scheduleJob( } ); ``` + +#### Monitor All Named Jobs + +Requires SDK version `11.5.0` or higher. + +Instead of wrapping `node-schedule`, you can add `nodeScheduleIntegration` to monitor every job created with `scheduleJob` that has a name: + +```JavaScript +Sentry.init({ + dsn: "___PUBLIC_DSN___", + integrations: [ + Sentry.nodeScheduleIntegration({ + excludeJobs: ["cleanup-temp-files", /^debug-/], // Optional. + }), + ], +}); +``` + +```JavaScript +import schedule from "node-schedule"; + +schedule.scheduleJob( + "daily-report", + { rule: "30 9 * * 1-5", tz: "Europe/Vienna" }, + sendReport +); +``` + +The monitor slug is the job name. Jobs without a name, and jobs that run once at a `Date`, aren't monitored. `excludeJobs` skips jobs whose name matches a string exactly or a regular expression. + +For cron strings, each check-in sends the schedule and time zone (your server's time zone if `tz` isn't set). Recurrence rules, and schedules that can't be expressed in the Crons schedule format (for example, a job that runs every 10 seconds), check in without a monitor config, so create those monitors in Sentry first. From 82409e0f7d48ae6188b130c874e00e3a73ac41e3 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Mon, 19 Oct 2026 17:49:25 -0700 Subject: [PATCH 2/2] docs(js): Recommend monitoring all node-schedule jobs first Co-Authored-By: Claude --- ...-crons-automatic-crons-instrumentation.mdx | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/includes/javascript-crons-automatic-crons-instrumentation.mdx b/includes/javascript-crons-automatic-crons-instrumentation.mdx index e3c4e35f14b4a..9c14cf1b79b92 100644 --- a/includes/javascript-crons-automatic-crons-instrumentation.mdx +++ b/includes/javascript-crons-automatic-crons-instrumentation.mdx @@ -81,29 +81,11 @@ cronWithCheckIn.schedule( ### Node Schedule -Requires SDK version `7.93.0` or higher. - -Use `Sentry.cron.instrumentNodeSchedule` to instrument the `schedule` export from the [`node-schedule`](https://www.npmjs.com/package/node-schedule) library. This returns an object with the same API as the original `schedule` export, but with the `scheduleJob` method instrumented. You can pass the name of the cron job as the first argument to the function. Currently this only supports cronstring as the second argument to `scheduleJob`. - -```JavaScript -import * as schedule from "node-schedule"; - -const scheduleWithCheckIn = Sentry.cron.instrumentNodeSchedule(schedule); - -scheduleWithCheckIn.scheduleJob( - "my-cron-job", - "* * * * *", - () => { - console.log("running a task every minute"); - } -); -``` - #### Monitor All Named Jobs Requires SDK version `11.5.0` or higher. -Instead of wrapping `node-schedule`, you can add `nodeScheduleIntegration` to monitor every job created with `scheduleJob` that has a name: +We recommend adding `nodeScheduleIntegration`, which monitors every job created with `scheduleJob` that has a name: ```JavaScript Sentry.init({ @@ -129,3 +111,25 @@ schedule.scheduleJob( The monitor slug is the job name. Jobs without a name, and jobs that run once at a `Date`, aren't monitored. `excludeJobs` skips jobs whose name matches a string exactly or a regular expression. For cron strings, each check-in sends the schedule and time zone (your server's time zone if `tz` isn't set). Recurrence rules, and schedules that can't be expressed in the Crons schedule format (for example, a job that runs every 10 seconds), check in without a monitor config, so create those monitors in Sentry first. + +#### Monitor Specific Jobs + +Requires SDK version `7.93.0` or higher. + +Use `Sentry.cron.instrumentNodeSchedule` to instrument the `schedule` export from the [`node-schedule`](https://www.npmjs.com/package/node-schedule) library. This returns an object with the same API as the original `schedule` export, but with the `scheduleJob` method instrumented. You can pass the name of the cron job as the first argument to the function. Currently this only supports cronstring as the second argument to `scheduleJob`. + +```JavaScript +import * as schedule from "node-schedule"; + +const scheduleWithCheckIn = Sentry.cron.instrumentNodeSchedule(schedule); + +scheduleWithCheckIn.scheduleJob( + "my-cron-job", + "* * * * *", + () => { + console.log("running a task every minute"); + } +); +``` + +`nodeScheduleIntegration` skips jobs created with `instrumentNodeSchedule`, so using both doesn't send duplicate check-ins.