Skip to content

crontask needs a way to configure the Sentry cron monitor #44

Closed

Description

@coredumperror

Sentry's cron monitor can accept a monitor_config in its constructor, which crontask doesn't let the user configure (it just doesn't send it at all).

Monitor configs are:

    MonitorConfig = TypedDict(
        "MonitorConfig",
        {
            "schedule": MonitorConfigSchedule,
            "timezone": str,
            "checkin_margin": int,
            "max_runtime": int,
            "failure_issue_threshold": int,
            "recovery_threshold": int,
            "owner": str,
        },
        total=False,
    )

I need this because my team's cron tasks keep getting erroneous "missed checkins" at random, which correct themselves immediately on the next run. I believe what's happening is that the task is taking just a little bit too long to start up, and increasing the checkin_margin config will make the missed cron warnings go away.

I'm going to submit a PR for this, but I'm not 100% sure how best to make it user-configurable. Perhaps a new key in the CRONTASK settings dict, "CRON_MONITOR_CONFIG": dict. I think I'll go with that to start.

Activity

  1. added
    bugSomething isn't working
    triageIdentifying, categorizing, prioritizing, and resolving bugs efficiently.
    on May 14, 2026
  2. codingjoe commented on May 14, 2026

    @codingjoe
    Owner

    Hi @coredumperror,

    Thank you for reaching out about this. We actually send a monitor config on each check-in since the last version; see ae12a07 by @amureki

    However, we only push the schedule and not any margins, owners, and co. Are those overridden for you? If so, this is something I would like to discuss with Sentry.

    Cheers!
    Joe

  3. coredumperror commented on May 14, 2026

    @coredumperror
    Author

    Hmm, odd. I dunno why my project's venv had an old version of the library installed when I made this issue. Glad to see that MonitorConfigs are now being sent in v1.2, tho.

    I see that, among the available settings in MonitorConfig, crontask seems to only send "schedule" and "timezone". It would be nice if crontask looked to the Django settings to optionally add the other config values, and/or if the @cron decorator took them as parameters.

    Based on what I'm seeing in my Sentry reports, it looks like the other settings are all being treated as "null", but I don't know how Sentry handles that situation. Does it just not consider checkin_margin at all when determining if a checkin failed?

    Image

    As for the topic of this issue, specifically, I do think it'd be nice if crontask allowed the user to define those other MonitorConfig values in some way. Perhaps a dictionary in CRONTASK, or as arguments to @cron.

  4. Repository owner locked and limited conversation to collaborators on May 15, 2026
  5. converted this issue into a discussion #49 on May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIdentifying, categorizing, prioritizing, and resolving bugs efficiently.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions