Skip to content

Add support for Sentry Crons to Celery Beat #1932

Closed
@antonpirker

Description

@antonpirker

Add a decorator for celery beat tasks (or something like) where you related a sentry monitor_id with the task.

In the task submit this events to sentry:

When the task starts:

{
    "event_id":"6650bef0d8ba4a70be1d9a5ed6ee5dff",
    "sent_at":"2023-03-01T14:08:34Z",
    "dsn":"xxx",
    "sdk":{
        "name":"sentry.python.celery",
        "version":"1.16.0"
    }
}
{"type":"check_in","content_type":"application\/json"}
{
    "check_in_id":"39588134018140db8b7eb6628bccb636",
    "monitor_id":"4dc8556e-0392-45c7-bd56-9f8cf513ea42",
    "status":"in_progress",
    "duration":null
}

When the task finishes (or errors, the the status needs to be "error"):

{
    "event_id":"ff8bd082278e48d9b6632f88d642cdba",
    "sent_at":"2023-03-01T14:08:34Z",
    "dsn":"xxx",
    "sdk":{
        "name":"sentry.python.celery",
        "version":"1.16.0"
    }
}
{"type":"check_in","content_type":"application\/json"}
{
    "check_in_id":"39588134018140db8b7eb6628bccb636",
    "monitor_id":"4dc8556e-0392-45c7-bd56-9f8cf513ea42",
    "status":"ok",
    "duration":null
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions