You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds `Sentry.withMonitor`, a wrapping function similar to
`Sentry.startSpan` that wraps a callback with a cron monitor. Under the
hood it uses `Sentry.captureCheckIn`, but having this as a callback
means that users don't have to think about passing `checkInId` around.
```ts
import * as Sentry from '@sentry/node';
// with monitor will send checkin when callback is started/finished
// works with async and sync callbacks.
const result = Sentry.withMonitor(
'dailyEmail',
() => {
// withCheckIn return value is same return value here
return sendEmail();
},
{
schedule: {
type: 'crontab',
value: '0 * * * *',
},
// 🇨🇦🫡
timezone: 'Canada/Eastern',
},
);
```
0 commit comments