Check-in monitoring allows you to track a job's progress by completing two check-ins: one at the start of your job and another at the end of your job. This two-step process allows Sentry to notify you if your job didn't start when expected (missed) or if it exceeded its maximum runtime (failed).
// 🟡 Notify Sentry your job is running:
const checkInId = Sentry.captureCheckIn({
monitorSlug: "<monitor-slug>",
status: "in_progress",
});
// Execute your scheduled task here...
// 🟢 Notify Sentry your job has completed successfully:
Sentry.captureCheckIn({
// Make sure this variable is named `checkInId`
checkInId,
monitorSlug: "<monitor-slug>",
status: "ok",
});
If your job execution fails, you can notify Sentry about the failure:
// 🔴 Notify Sentry your job has failed:
Sentry.captureCheckIn({
// Make sure this variable is named `checkInId`
checkInId,
monitorSlug: "<monitor-slug>",
status: "error",
});
Heartbeat monitoring notifies Sentry of a job's status through one check-in. This setup will only notify you if your job didn't start when expected (missed). If you need to track a job to see if it exceeded its maximum runtime (failed), use check-ins instead.
// Execute your scheduled task...
// 🟢 Notify Sentry your job completed successfully:
Sentry.captureCheckIn({
monitorSlug: "<monitor-slug>",
status: "ok",
});
If your job execution fails, you can:
// 🔴 Notify Sentry your job has failed:
Sentry.captureCheckIn({
monitorSlug: "<monitor-slug>",
status: "error",
});