-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add cron monitor wrapper helper (#9395)
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', }, ); ```
- Loading branch information
1 parent
3545fd5
commit 697f406
Showing
13 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ export { | |
trace, | ||
withScope, | ||
captureCheckIn, | ||
withMonitor, | ||
setMeasurement, | ||
getActiveSpan, | ||
startSpan, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ export { | |
trace, | ||
withScope, | ||
captureCheckIn, | ||
withMonitor, | ||
setMeasurement, | ||
getActiveSpan, | ||
startSpan, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ export { | |
trace, | ||
withScope, | ||
captureCheckIn, | ||
withMonitor, | ||
} from '@sentry/node'; | ||
|
||
export type { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ export { | |
trace, | ||
withScope, | ||
captureCheckIn, | ||
withMonitor, | ||
setMeasurement, | ||
getActiveSpan, | ||
startSpan, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ export { | |
trace, | ||
withScope, | ||
captureCheckIn, | ||
withMonitor, | ||
setMeasurement, | ||
getActiveSpan, | ||
startSpan, | ||
|