-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(crons): Add Node SDK cron monitoring docs (#6842)
Co-authored-by: Shana Matthews <shana.l.matthews@gmail.com> Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
- Loading branch information
1 parent
64db518
commit e68267c
Showing
8 changed files
with
73 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
```javascript | ||
Sentry.configureScope(function (scope) { | ||
scope.setContext("monitor", { | ||
slug: "<monitor-slug>", | ||
}); | ||
}); | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Use our <PlatformLink to="/">getting started</PlatformLink> guide to install and configure the Sentry Node SDK (min v7.51.1) for your recurring job. | ||
- [Create and configure](https://sentry.io/crons/create/) your first Monitor. |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
## Check-Ins (Recommended) | ||
|
||
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). | ||
|
||
```javascript | ||
// 🟡 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({ | ||
checkInId, | ||
monitorSlug: "<monitor-slug>", | ||
status: "ok", | ||
}); | ||
``` | ||
|
||
If your job execution fails, you can notify Sentry about the failure: | ||
|
||
```javascript | ||
// 🔴 Notify Sentry your job has failed: | ||
Sentry.captureCheckIn({ | ||
checkInId, | ||
monitorSlug: "<monitor-slug>", | ||
status: "error", | ||
}); | ||
``` | ||
|
||
## Heartbeat | ||
|
||
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. | ||
|
||
```javascript | ||
// Execute your scheduled task... | ||
|
||
// 🟢 Notify Sentry your job completed successfully: | ||
Sentry.captureCheckIn({ | ||
monitorSlug: "<monitor-slug>", | ||
status: "ok", | ||
}); | ||
``` | ||
|
||
If your job execution fails, you can: | ||
|
||
```javascript | ||
// 🔴 Notify Sentry your job has failed: | ||
Sentry.captureCheckIn({ | ||
monitorSlug: "<monitor-slug>", | ||
status: "error", | ||
}); | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### How Do I Send an Attachment With a Check-in (Such as a Log Output)? | ||
|
||
Attachments aren't supported by our Node SDK yet. For now, you can use the [check-in attachments API](/product/crons/getting-started/http/#check-in-attachment-optional). |
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
e68267c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
sentry-docs – ./
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev
docs.sentry.io