-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(crons): Add Node SDK cron monitoring docs #6842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8434707
feat(crons): Add Node SDK cron monitoring docs
AbhiPrasad 6692bd8
adjust
AbhiPrasad ab80ec0
check in id
AbhiPrasad 670f55c
make sure node page shows up for crons troubleshooting
AbhiPrasad 421fe56
update minimum version
AbhiPrasad 2574a09
style(lint): Auto commit lint changes
getsantry[bot] 242afb1
fix heartbeat snippet
AbhiPrasad 0bd9af2
style(lint): Auto commit lint changes
getsantry[bot] 65afb93
style(lint): Auto commit lint changes
getsantry[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This content doesn't appear in the preview.
I think you missed adding
<PlatformSection supported={["python", "php", "node"]}>
to
src/platforms/common/crons/troubleshooting-crons.mdx
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.
Good catch! Fixed with 8a30507