node-schedule Integration

Automatically monitor your node-schedule jobs with seamless instrumentation.

Use Sentry.cron.instrumentNodeSchedule to instrument the schedule export from the 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.

Requires SDK version 7.93.0 or higher.

Copied
import * as Sentry from "@sentry/node";
import * as schedule from "node-schedule";

const scheduleWithCheckIn = Sentry.cron.instrumentNodeSchedule(schedule);

scheduleWithCheckIn.scheduleJob("my-cron-job", "* * * * *", () => {
  console.log("running a task every minute");
});
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").