Cron Job Monitoring Beta - Because scheduled jobs fail too
Do your cron jobs (aka scheduled jobs) ever fail or not run as expected? Scheduled jobs are supposed to be predictable – as the name implies. But as with many things, predictable != reliable. Cron jobs fail too and we think you should know when that happens, Crons allows you to monitor the uptime and performance of any scheduled, recurring job in Sentry. Once set up, you’ll get alerts and metrics to help you solve errors, detect timeouts, and prevent disruptions to your service.
Many cron jobs and recurring tasks go unmonitored
Customers frequently tell us that many cron jobs and recurring tasks are not being monitored like their regular web services and frontends are. Some reasons:
- Not enough budget to justify paying for a dedicated cron monitoring tool
- Too much time and the learning curve involved to adopt a new monitoring tool
- Some jobs are not considered critical
However, whether you have cron jobs set up for processing invoices, executing data integrity, sending notifications to customers, etc. the effects of a failure isn’t always isolated. For example, you have a cron job that deletes old data from a database that fails to execute, causing the database to grow in size until your customers start complaining about latency. This means that even a seemingly minor or non-critical job can have cascading effects on the overall system if they fail.
With Sentry’s cron job monitoring, you don’t have to worry about a failed job going unnoticed and causing collateral damage across your app. Sentry will tell you when a failure happens or a job didn’t run as scheduled, and give you the context needed to fix it – as we do with every error or performance issue.
Step 1: Go to the new Crons (beta) tab
Navigate to the Crons (beta) tab, click “New Cron Monitor” and pick a project. Next, you provide some basic info about your job, including its frequency and length, and see the instrumentation details to add it to your project.
Step 2: How to instrument a cron monitor
You have two options:
- Use Sentry’s CLI to automatically wrap your job execution and notify Sentry of its status.
- Manually configure two HTTP requests in your job. You can see an example in our documentation.
sentry-cli monitors run 63261d96-2027-472a-a8bb-9895dbebd793 -- python path/to/file.py
Example CLI set up
Step 3: Get notified when you need to be
You can go to the Crons tab to see stats and charts related to your jobs. But most importantly, you can count on Sentry to monitor your Cron Jobs and send alerts if something goes wrong. Remember to customize your alert rules in the Alerts tab.
Note: Crons is currently in beta, so we don’t recommend using it to monitor critical jobs. But… we are confident it’s not too janky. Also, there is no additional cost for using Crons. Any cron job-related errors are treated just like any other code error and will pull from your Errors event quota.
Sentry’s easy-to-set-up Cron Job Monitoring product is a lightweight way to get additional confidence that your regularly scheduled jobs are successfully executing on time. Crons is free to use during this beta period, which we expect to last at least six months. We value your feedback; we encourage you to share that feedback in our GitHub discussion.
Join us on Twitter or in the Crons channel in our Discord. And if you’re new to Sentry, you can try it for free today or request a demo to get started.