getsentry / getsentry/sentry-python

Crons: Celerybeat integration provides invalid Crontab schedule

未关闭
#3,131 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Checks Crons Feature Integration: Celery Python
主要语言
Python
星标
2.2k
派生
669
平均合并
1 天 1 小时
30 天内合并 PR
213

描述

### How do you use Sentry?

Sentry Saas (sentry.io)

### Version

2.3.1

### Steps to Reproduce

Create a new Celery task with a crontab schedule of "0 0 * * saturday". The monitor for the task won't be upserted in Crons.

### Expected Result

The monitor and check-ins should be created in Crons.

### Actual Result

This happens because `0 0 * * saturday` is not a valid crontab schedule, but it is a [valid task schedule](https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html#crontab-schedules) in Celery.

This is the complete payload that has failed validation on our end:

```json
{
"check_in_id": "82f57c609739414a8e21a88165fd52d8",
"contexts": {
"trace": {
"trace_id": "8e424a9d5c7b462b8ccb638b3b9c98cc"
}
},
"duration": 1602.9272508621216,
"environment": "prod",
"monitor_config": {
"schedule": {
"type": "crontab",
"value": "0 0 * * saturday"
},
"timezone": "UTC"
},
"monitor_slug": "schedule-weekly-organization-reports-new",
"status": "ok"
}
```

Here's the definition for the task: https://github.com/getsentry/sentry/blob/d92153e4f39810ed5b91a1e5e340a51e3cf507ec/src/sentry/conf/server.py#L1112-L1116

Perhaps we can map these unique Celery schedule definitions to a valid Crontab? Celery also supports [solar schedules](https://docs.celeryq.dev/en/stable/userguide/periodic-tasks.html#solar-schedules
), so not sure what we want to do there.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。