-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Problem Statement
When cron events are pushed to sentry with 6 part schedule the upsert fails.
The error message just suggest doing to docs without details on what went wrong
Solution Brainstorm
From what i've found failing on non 5-part crons is by design
#44942
#47040
While the bigger issue is missing support for extended syntax, if that's still backlog level issue the minimum i suggest is putting a warning on the docs (for the sdks which wrap libs with 6+ parts support) near the usage examples. Currently it is only on the troubleshooting page, but i feel like people should realize this before running the code, not after digging through docs when it fails. Also having a more specific error message in UI would be nice
A few solution ideas i have for extended syntax support:
It was mentioned in some of the issues that 6 part syntax might be adding 6th part with different meaning.
From my limited understanding of the implementations you have i believe it should be possible to define mapping (on per sdk basis) to some unified format which the sentry backend would understand and use that to send the check-ins.
A less intrusive solution is to give an option to map the schedule ourselves.
For example for the sdk i'm using https://docs.sentry.io/platforms/javascript/guides/node/crons/#cron 6th part is seconds
The common use of the seconds part is to balance tasks so that they don't overlap too much. If it's possible to control the string the check-ins use we can utilize the seconds timing and have sentry backend understand what we are doing.
import { CronJob } from "cron";
const CronJobWithCheckIn = Sentry.cron.instrumentCron(CronJob, "my-cron-job");
// function mapping
const job = new CronJobWithCheckIn("17 */30 * * * *", () => { ... }, {
checkInCronTimeMapper: (rawCronTime) => rawCronTime.split(" ").slice(1).join(" ")
});
// or explicit definition
const job = new CronJobWithCheckIn("17 */30 * * * *", () => { ... }, {
checkInCronTime: "*/30 * * * *"
});
But there's also stuff like "*/15 * * * * *"
I can't really say if the current data model wouldn't blow up if multiple check-ins are pushed in the same minute :)
Product Area
Crons
Metadata
Metadata
Assignees
Labels
Type
Projects
Status