-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Cron: Add support for parsing Luxon zones #13820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @SerenModz21! Could you provide a code snippet for an invalid configuration? |
Hi @chargome, Here is the JSON that the Sentry UI shows when hovering over {
"check_in_id": "2d5df2bbab174379a7766da9bb009110",
"contexts": {
"trace": {
"trace_id": "c4efe303546241a2bbba5018c036f97b"
}
},
"environment": "production",
"monitor_config": {
"schedule": {
"type": "crontab",
"value": "0 */3 * * *"
},
"timezone": "system"
},
"monitor_slug": "update-leveling",
"status": "in_progress"
} As for code, I make use of classes and TypeScript decorators to work with my codebase. However, if I had to compact it all down to be minimal and to show it here, this is what it would be: import { CronJob } from "cron";
const cronJob = sentry.cron.instrumentCron(CronJob, "update-leveling");
cronjob.from({
cronTime: "0 */3 * * *",
onTick: () => { /* code that gets executed */ },
timeZone: "system"
}); The cron jobs themselves work fine and cron jobs that I had existing before explicitly setting the timezone to Lastly, I know omitting the timezone or providing a TZ/IANA timezone will resolve the issue. I believe Sentry should still support parsing Luxon's zones. |
@SerenModz21 got it, I'll raise this in the team (but tbh I'm not sure if we'll add Luxon support here). Meanwhile you'll need to parse it yourself and provide the TZ timezone for the config. |
Problem Statement
The cron package uses Luxon for time zones. This allows us to specify
system
to use the system timezone for example. Information about this can be found here: https://github.com/moment/luxon/blob/master/docs/zones.md#specifying-a-zoneHowever, the problem that currently stands is that these zones aren't supported and thus cause Sentry to show an invalid monitor configuration error for new cron jobs.
Solution Brainstorm
I believe that Sentry should parse Luxon zones in the automatic cron instrumentation, before sending them to the API. While I do mention providing
system
(which is also the default if not provided), It's still a limitation to what can be provided. I have included a link to the documentation along with an image for such.The text was updated successfully, but these errors were encountered: