From 91a532f90a796fe926313db0d95dfa0139e649f2 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Fri, 16 Oct 2026 17:55:19 -0700 Subject: [PATCH 1/2] docs(js): Document nodeCronIntegration for Crons Co-Authored-By: Claude --- ...-crons-automatic-crons-instrumentation.mdx | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/includes/javascript-crons-automatic-crons-instrumentation.mdx b/includes/javascript-crons-automatic-crons-instrumentation.mdx index 8b78d165e0cf2c..c9d7f216ebca46 100644 --- a/includes/javascript-crons-automatic-crons-instrumentation.mdx +++ b/includes/javascript-crons-automatic-crons-instrumentation.mdx @@ -45,6 +45,36 @@ cronWithCheckIn.schedule( ); ``` +#### Monitor All Named Tasks + +Requires SDK version `11.5.0` or higher. + +Instead of wrapping `node-cron`, you can add `nodeCronIntegration` to monitor every task that has a `name`, without changing how you import `node-cron`: + +```JavaScript +Sentry.init({ + dsn: "___PUBLIC_DSN___", + integrations: [ + Sentry.nodeCronIntegration({ + excludeJobs: ["cleanup-temp-files", /^debug-/], // Optional. + }), + ], +}); +``` + +```JavaScript +import cron from "node-cron"; + +cron.schedule("0 9 * * 1-5", sendReport, { + name: "daily-report", + timezone: "Europe/Vienna", +}); +``` + +The monitor slug is the task's `name`. Tasks without a `name` aren't monitored. `excludeJobs` skips tasks whose name matches a string exactly or a regular expression. + +Each check-in sends the task's schedule and time zone (your server's time zone if `timezone` isn't set). Schedules that can't be expressed in the Crons schedule format (for example, a task that runs every 10 seconds) check in without a monitor config, so create those monitors in Sentry first. + ### Node Schedule Requires SDK version `7.93.0` or higher. From 0c07af9abc202e6db9acf21b615879237effe474 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Mon, 19 Oct 2026 17:49:09 -0700 Subject: [PATCH 2/2] docs(js): Recommend monitoring all node-cron tasks 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 c9d7f216ebca46..8386cb29182fdf 100644 --- a/includes/javascript-crons-automatic-crons-instrumentation.mdx +++ b/includes/javascript-crons-automatic-crons-instrumentation.mdx @@ -27,29 +27,11 @@ const job = CronJobWithCheckIn.from({ ### Node Cron -Requires SDK version `7.92.0` or higher. - -Use `Sentry.cron.instrumentNodeCron` to instrument the `cron` export from the [`node-cron`](https://www.npmjs.com/package/node-cron) library. This returns an object with the same API as the original `cron` export, but with the `schedule` method instrumented. You can pass the name of the cron monitor and an optional time zone as part of the third options argument to the function. - -```JavaScript -import cron from "node-cron"; - -const cronWithCheckIn = Sentry.cron.instrumentNodeCron(cron); - -cronWithCheckIn.schedule( - "* * * * *", - () => { - console.log("running a task every minute"); - }, - { name: "my-cron-job" } -); -``` - #### Monitor All Named Tasks Requires SDK version `11.5.0` or higher. -Instead of wrapping `node-cron`, you can add `nodeCronIntegration` to monitor every task that has a `name`, without changing how you import `node-cron`: +We recommend adding `nodeCronIntegration`, which monitors every task that has a `name`, without changing how you import `node-cron`: ```JavaScript Sentry.init({ @@ -75,6 +57,28 @@ The monitor slug is the task's `name`. Tasks without a `name` aren't monitored. Each check-in sends the task's schedule and time zone (your server's time zone if `timezone` isn't set). Schedules that can't be expressed in the Crons schedule format (for example, a task that runs every 10 seconds) check in without a monitor config, so create those monitors in Sentry first. +#### Monitor Specific Tasks + +Requires SDK version `7.92.0` or higher. + +Use `Sentry.cron.instrumentNodeCron` to instrument the `cron` export from the [`node-cron`](https://www.npmjs.com/package/node-cron) library. This returns an object with the same API as the original `cron` export, but with the `schedule` method instrumented. You can pass the name of the cron monitor and an optional time zone as part of the third options argument to the function. + +```JavaScript +import cron from "node-cron"; + +const cronWithCheckIn = Sentry.cron.instrumentNodeCron(cron); + +cronWithCheckIn.schedule( + "* * * * *", + () => { + console.log("running a task every minute"); + }, + { name: "my-cron-job" } +); +``` + +`nodeCronIntegration` skips tasks created with `instrumentNodeCron`, so using both doesn't send duplicate check-ins. + ### Node Schedule Requires SDK version `7.93.0` or higher.