Set Up Crons

Sentry Crons allows you to monitor the uptime and performance of any scheduled, recurring job. Once implemented, it'll allow you to get alerts and metrics to help you solve errors, detect timeouts, and prevent disruptions to your service.


Automatic Crons Instrumentation

If you're using Celery Beat to run your periodic tasks, have a look at our Celery Beat Auto Discovery documentation.

Job Monitoring

Use the Python SDK to monitor and notify you if your periodic task is missed (or doesn't start when expected), if it fails due to a problem in the runtime (such as an error), or if it fails by exceeding its maximum runtime.

import sentry_sdk
from sentry_sdk.crons import monitor

# Add the @monitor decorator to your task
def tell_the_world(msg):
    # Scheduled task here...

# monitor can also be used as a context manager
def tell_the_world_contextmanager(msg):
    with monitor(monitor_slug='<monitor-slug>'):
        # Scheduled task here...


When your recurring job fails to check in (missed), runs beyond its configured maximum runtime (failed), or manually reports a failure, Sentry will create an error event with a tag to your monitor.

To receive alerts about these events:

  1. Navigate to Alerts in the sidebar.
  2. Create a new alert and select "Issues" under "Errors" as the alert type.
  3. Configure your alert and define a filter match to use: The event's tags match {key} {match} {value}.

Example: The event's tags match monitor.slug equals my-monitor-slug-here

Cron completed alert filter

Learn more in Issue Alert Configuration.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").