-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(node): Add ability to send cron monitor check ins #8039
Conversation
In Python and PHP, we opted to use |
Easy to understand - and means we don't further overload |
@@ -44,7 +44,7 @@ describe('CheckIn', () => { | |||
duration: 10.0, | |||
release: '1.0.0', | |||
environment: 'production', | |||
} as CheckIn, | |||
} as SerializedCheckIn, |
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.
giga l: you can simply do as const
instead of as SerializedCheckIn
here. TS is only complaining because status
is interpreted as string
.
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.
Gonna keep this anyway because I prefer the explicitness of the type.
}, | ||
checkinMargin: 2, | ||
maxRuntime: 12333, | ||
timezone: 'Canada/Eastern', |
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.
🫡
Closes #8006
Sentry has a cron monitoring product! This PR adds cron monitoring support to the Node SDK, so you can use the SDK to easily monitor your cron jobs!
You can monitor your cron jobs by sending check-ins to Sentry whenever they start and stop! If you notice a cron hasn't checked in, or has not submitted a finish check-in, you know there is something wrong and you need to investigate!
Based on the work in #7996, we expose a top level API to send check ins to Sentry. Currently there is no hub level method to do this, that was done intentionally.
To send a check in to Sentry, simply use the
captureCheckIn
method exported from the SDK. First you must send anin_progress
, checkin, then you can send one with statusok
orerror
based on what happened with your cron job.You can also optionally add a monitor config so you can create a monitor automatically, without needing to go into Sentry and setting up a cron monitor.
Added some basic unit tests, and validated sending in Sentry as well.