Share on Twitter
Share on Facebook
Share on HackerNews
Share on LinkedIn

Cron Monitoring is Now Generally Available

Sentry Cron Monitoring alerts you when your scheduled jobs fail and gives you the context you need to fix it - like we do with error and performance issues. Cron Monitoring focuses on serving code-level insights behind missed and failed jobs and relating them to errors already in your issue stream.

Sometimes a failed cron job can become a problem overtime, while other times it can be an “oh $%^&” the job distributing payroll didn’t run kind of problem. Initially, we thought failed cron jobs were an infrastructure problem, but after chatting with the Sentry engineers that manage these jobs, we quickly found out that most failures are code-related. As Sentry focuses on serving developers code-related insights, we believe Cron Monitoring is another handy tool to put in the Sentry developer toolbelt.

We received a lot of helpful feedback for Cron Monitoring from the thousands of organizations using it. After incorporating the feedback, the time has come to remove the beta tag and make Cron Monitoring generally available.

In this post we’ll share how to approach which jobs to monitor, how organizations like fintech startup Wrapbook are using Cron Monitoring, and features to keep your scheduled jobs on track.

Monitor Now, Save Time Later

Cron Monitoring alerts your team when a recurring job fails or misses a check-in, and surfaces any related errors. It also tracks the performance of your cron jobs overtime.

For many, once a job is scheduled, it’s out of sight and out of mind … until it fails.

Wrapbook is a media focused payroll startup with a number of recurring jobs. Staff Engineer, Spencer Rogers, at Wrapbook noted after seeing the cascading effects of a missed job, the team started monitoring via a simple alert for job starts. This worked until a job started failing mid-run. After spending precious time fixing the issue, that would have been less work if caught earlier, the team started using Cron Monitoring.

The biggest value we get is detecting and solving minor issues before they grow into large problems impacting our customers and business. In that sense, we may save days of headaches by uncovering an issue quickly. Compound this by the number of people involved to resolve an issue, and it becomes a measurable cost savings too.

The majority of the time, your recurring jobs are probably doing what they should be doing. However, all it takes is a series of unnoticed failures to sidetrack your sprint. But … do you need to monitor every scheduled job?

Which Jobs Should You Monitor?

Spencer summed it up nicely, “In practice this means two categories of jobs: those that would be problematic if they were not to run on schedule, and those which are often forgotten and become problematic over time”.

Wrapbook used Sentry to spot an issue where scheduled tasks were missed during active deploys. Tasks due to be scheduled were getting skipped if there was an update happening at the same time. Left unnoticed, this unexpected behavior could lead to a number of downstream issues, and overtime cause datasets to grow, overusing system resources - not to mention a lot of time to fix. They caught this early by noticing the pattern of missing tasks in Cron Monitoring.

Fast Set Up, Alerting Rules and Error Tracing

Cron Monitoring is integrated into Sentry SDKs to make it simple (like two lines of code simple) to set up your monitors. We also added upsert support for SDKs and integrations like PHP, Node, Go, Celery, Next.js and more so you can set up your monitors in bulk. Also, if you are using Celery Beat or Next.js hosted on Vercel, by adding one to two lines of code, Sentry will automatically detect and configure your monitors.

Not every failed job warrants an alert. The new Margins alerting feature tells Sentry when to mark a job as failed or missed, and Failure and Recovery Thresholds define when to create or resolve an issue.

crons configurations

Staff Engineer, Spencer Rogers, noted, “Features like Recovery and Failure Tolerance, along with the Grace Period have been big for us. By adding this context, it helps us avoid human errors and saves us time”.

When a job fails or check-ins are missed, it will appear as an issue in your issue stream, with all the issue features (assignment, resolution, etc.) you’re familiar with. Additionally, you can trace missed check-ins or job failures back to errors in Sentry from the monitor details page.

Just The Beginning

Monitoring your scheduled jobs isn’t always about averting an immediate crisis; it’s about gaining insights that contribute to the overall uptime and reliability of your application. By identifying and resolving issues early, you not only save time and resources, but maintain a positive user experience.

Cron Monitoring is a first step towards building a comprehensive tool for measuring the availability of your app, served with all the code-level insights you’ve come to expect from Sentry. Stay tuned for what’s next – we’re just getting started.

Want to test it out? All Sentry account plans include one monitor with unlimited check-ins - down to the minute. You can purchase additional monitors on-demand for $0.78 per monitor, per month on your subscription settings page.

If you have any questions or feedback, shoot us a note on Discord.

Your code is broken. Let's Fix it.
Get Started

More from the Sentry blog

ChangelogCodecovDashboardsDiscoverDogfooding ChroniclesEcosystemError MonitoringEventsGuest PostsMobileOpen SourcePerformance MonitoringRelease HealthResourceSDK UpdatesSentry
© 2024 • Sentry is a registered Trademark
of Functional Software, Inc.