Repository navigation
ref(server-utils): Share one cron converter across cron integrations - #25918
Merged
Merged
Conversation
@SentryCron, Sentry.cron.* and nodeCronIntegration each turned cron expressions into monitor configs on their own. They now all use cronExpressionToMonitorConfig from @sentry/server-utils, so they can't drift apart.
Contributor
size-limit report 📦Compared: 8f77286 (PR test merge using develop at c7b765f) Against: c7b765f (develop) · base run #66318 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 4 not successful, 59 successful. See the run.
Successful checks
|
…onverter # Conflicts: # packages/node/src/cron/cron.ts # packages/node/src/cron/node-schedule.ts # packages/server-utils/src/index.ts # packages/server-utils/src/utils/cronMonitoring.ts # packages/server-utils/test/utils/cronMonitoring.test.ts
wedamija
marked this pull request as ready for review
November 3, 2026 19:49
wedamija
requested review from
andreiborza,
mydea,
nicohrubec and
s1gr1d
and removed request for
a team
November 3, 2026 19:49
wedamija
marked this pull request as draft
November 3, 2026 20:15
cron ignores a day field that lists every day. cron-parser counts duplicate values instead, and reads a weekday range that ends on 7 as including Sunday. Each scheduler now gets its own dialect, so cron-parser quirks no longer drop cron schedules and cron rules no longer send configs that node-schedule reads differently.
…nges The schedulers run `13-13/3` only on the 13th, but Sentry reads it as `13/3`.
… supports cron and cron-parser reject full names like `sunday` and some nicknames like `@annually`, so they now send no monitor config either. node-cron accepts full names.
instrumentNodeCron can't tell the node-cron version, and before 4.6 node-cron reads ranges like `5-0`, `sat-sun` and `1-7` and some steps differently. It now sends no monitor config for those, like nodeCronIntegration does.
The suites ran per-second jobs, which send no monitor config. They now run a weekday schedule by hand.
…ode-cron 4.6 node-cron before 4.6 reads a step without a range, like `5/10`, as its start.
# Conflicts: # CHANGELOG.md
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4fb2d9f. Configure here.
The cron and cron-parser packages reject ranges like sat-sun, so don't send a monitor config for them.
cron-parser and Sentry read `L` in the day of month and `5L` and `5#2` in the day of week the same way, so send those as monitor config. Forms they read differently, like `#` with a restricted day of month, still send none. Co-Authored-By: Claude <noreply@anthropic.com>
…onverter # Conflicts: # CHANGELOG.md
Anchoring the regex keeps it linear on long digit runs (CodeQL js/polynomial-redos).
A dropped seconds value like 59 in '59 0 9 * * *' leaves about a second of slack against Sentry's default 1-minute margin. @SentryCron keeps a larger margin set by the user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… have Sentry rejects schedules like '0 9 31 2,4 *', which cron-parser runs on the day of week. A fuzz of cron-parser 4 and 5 against cronsim found no other differences, so the cron-parser dialect covers both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s1gr1d
reviewed
Nov 12, 2026
Sentry's upsert overwrites every field a check-in sends, so an automatic margin would replace one set in Sentry. @SentryCron sends only the margin passed to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ERNAL_ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s1gr1d
approved these changes
Nov 13, 2026
nicohrubec
added a commit
that referenced
this pull request
Nov 17, 2026
## What Merge `master` into `develop` after the 11.13.0 release, with the `CHANGELOG.md` conflict resolved. Supersedes #26429. ## Why #25918 landed on `develop` during the 11.13.0 release and added its entry to the old "Unreleased" block, which became `## 11.13.0` on `master`. #25918 isn't in 11.13.0, so its entry moves under `## Unreleased` and the 11.13.0 section stays as released (same resolution as #21298). Merge this with "Create a merge commit", not squash, then close #26429. <!-- junior-request-attribution:start --> via **Nicolas Hrubec**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0CEC49NJUD%3A1794902389.499919 --> -- [View Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CEC49NJUD%3A1794902389.499919) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CEC49NJUD%3A1794902389.499919/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Andrei Borza <andrei.borza@sentry.io> Co-authored-by: Andrei <168741329+andreiborza@users.noreply.github.com> Co-authored-by: Nicolas Hrubec <nicolas.hrubec@outlook.com> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: Charly Gomez <charly.gomez1310@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Francesco Gringl-Novy <francesco.novy@sentry.io> Co-authored-by: Martin Sonnberger <martin.sonnberger@sentry.io> Co-authored-by: BYK <126780+BYK@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Miguel Betegon <miguel.betegon@sentry.io> Co-authored-by: bete <28983162+betegon@users.noreply.github.com> Co-authored-by: Rola Abuhasna <rola.abuhasna@sentry.io> Co-authored-by: Tim Fish <tim@timfish.uk> Co-authored-by: Abdelrahman Awad <abdelrahman.awad@sentry.io> Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: whatever_kunaal <143793407+kunal649@users.noreply.github.com> Co-authored-by: javascript-sdk-gitflow[bot] <255134079+javascript-sdk-gitflow[bot]@users.noreply.github.com> Co-authored-by: s1gr1d <32902192+s1gr1d@users.noreply.github.com> Co-authored-by: isaacs <i@izs.me> Co-authored-by: Isaac Schlueter <isaac.schlueter@sentry.io> Co-authored-by: Jan Peer Stöcklmair <jan.peer@sentry.io> Co-authored-by: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com> Co-authored-by: bardrop <mradulsingh524.ms@gmail.com> Co-authored-by: msonnb <26038247+msonnb@users.noreply.github.com> Co-authored-by: David Cramer <23610+dcramer@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Vivek Singh <72497717+Vivek1898@users.noreply.github.com> Co-authored-by: alexcastgonz <82875882+pcbeingused333@users.noreply.github.com> Co-authored-by: sentry-release-bot[bot] <180476844+sentry-release-bot[bot]@users.noreply.github.com> Co-authored-by: Nicolas Hrubec <nico.hrubec@sentry.io>
51 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Part of a series adding automatic Crons monitoring for the most-used job schedulers in each SDK. Check-ins for a monitor that doesn't exist yet are dropped, so today each monitor has to be created by hand with its schedule copied from the code. Sending the job's schedule as the monitor config lets Sentry create the monitor and keep it in sync.
isaacs asked in review of #25013 for one cron converter, so
@SentryCron,Sentry.cron.*and the scheduler integrations read schedules the same way and can't drift apart. They now all use one converter in@sentry/server-utils, which takes the scheduler's dialect (node-cron,cronorcron-parser), since they read day fields, names and nicknames differently.For
Sentry.cron.instrumentCron,instrumentNodeCronandinstrumentNodeSchedule, this means: without a time zone, they send the server's time zone instead of letting Sentry assume UTC. Expressions Sentry would read differently than the scheduler, like per-second schedules or0 9 31 2,4 *, send no monitor config, so existing monitors keep their schedule.