-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dd3a43
commit 1ee6b8f
Showing
6 changed files
with
85 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Use our <PlatformLink to="/">getting started</PlatformLink> guide to install and configure the Sentry Ruby SDK (min v5.12.0) 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,73 @@ | ||
## Job Monitoring | ||
|
||
Standard job frameworks such as `ActiveJob` and `Sidekiq` with a `perform` method can use the `Sentry::Cron::MonitorCheckIns` mixin module to automatically capture check-ins. | ||
|
||
```rb {tabTitle: ActiveJob} | ||
class ExampleJob < ApplicationJob | ||
include Sentry::Cron::MonitorCheckIns | ||
|
||
sentry_monitor_check_ins | ||
|
||
def perform(*args) | ||
# do stuff | ||
end | ||
end | ||
``` | ||
|
||
```rb {tabTitle: Sidekiq} | ||
class SidekiqJob | ||
include Sidekiq::Job | ||
include Sentry::Cron::MonitorCheckIns | ||
|
||
sentry_monitor_check_ins | ||
|
||
def perform(*args) | ||
# do stuff | ||
end | ||
end | ||
``` | ||
|
||
You can pass in optional attributes to `sentry_monitor_check_ins` as follows. | ||
|
||
```rb | ||
# slug defaults to the job class name | ||
sentry_monitor_check_ins slug: 'custom_slug' | ||
|
||
# define the monitor config with an interval | ||
sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_interval(1, :minute) | ||
|
||
# define the monitor config with a crontab | ||
sentry_monitor_check_ins monitor_config: Sentry::Cron::MonitorConfig.from_crontab('5 * * * *') | ||
``` | ||
|
||
## Manual Setup | ||
|
||
### 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). | ||
|
||
```ruby | ||
check_in_id = Sentry.capture_check_in('<monitor-slug>', :in_progress) | ||
# Execute your scheduled task here... | ||
Sentry.capture_check_in('<monitor-slug>', :ok, check_in_id: check_in_id) | ||
``` | ||
|
||
If your job execution fails, you can notify Sentry about the failure: | ||
|
||
```ruby | ||
Sentry.capture_check_in('<monitor-slug>', :error, check_in_id: check_in_id) | ||
``` | ||
|
||
### 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. | ||
|
||
```ruby | ||
Sentry.capture_check_in('<monitor-slug>', :ok) | ||
``` | ||
|
||
If your job execution fails, you can notify Sentry about the failure: | ||
|
||
```ruby | ||
Sentry.capture_check_in('<monitor-slug>', :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
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 Ruby 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
1ee6b8f
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
docs.sentry.io
sentry-docs-git-master.sentry.dev