Skip to content

ref(server-utils): Share one cron converter across cron integrations - #25918

Merged
wedamija merged 22 commits into
developfrom
danf/shared-cron-converter
Nov 16, 2026
Merged

wedamija merged 22 commits into
developfrom
danf/shared-cron-converter

Conversation

@wedamija

@wedamija wedamija commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

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, cron or cron-parser), since they read day fields, names and nicknames differently.

For Sentry.cron.instrumentCron, instrumentNodeCron and instrumentNodeSchedule, 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 or 0 9 31 2,4 *, send no monitor config, so existing monitors keep their schedule.

@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.
@wedamija wedamija self-assigned this Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
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.

Path Size % Change Change
@sentry/browser 30.1 kB - -
@sentry/browser - with treeshaking flags 28.3 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.2 kB - -
@sentry/browser (incl. Tracing) 52.28 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.29 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.25 kB - -
@sentry/browser (incl. Tracing, Replay) 92.82 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.6 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.21 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.6 kB - -
@sentry/browser (incl. Feedback) 47.73 kB - -
@sentry/browser (incl. sendFeedback) 30.69 kB - -
@sentry/browser (incl. FeedbackAsync) 35.69 kB - -
@sentry/browser (incl. Metrics) 31.43 kB - -
@sentry/browser (incl. Logs) 31.71 kB - -
@sentry/browser (incl. Metrics & Logs) 32.37 kB - -
@sentry/react 32.11 kB - -
@sentry/react (incl. Tracing) 54.95 kB - -
@sentry/vue 38.3 kB - -
@sentry/vue (incl. Tracing) 55.24 kB - -
@sentry/svelte 30.12 kB - -
@sentry/remix (Remix 3 client bundle) 58.06 kB - -
CDN Bundle 31.87 kB - -
CDN Bundle (incl. Tracing) 52.7 kB - -
CDN Bundle (incl. Logs, Metrics) 34.67 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.26 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 75.7 kB - -
CDN Bundle (incl. Tracing, Replay) 90.72 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.09 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.69 kB - -
CDN Bundle - uncompressed 92.98 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.45 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 101.33 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 163.08 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 231.44 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.61 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 283.24 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 287.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.02 kB - -
@sentry/nextjs (client) 58.57 kB - -
@sentry/sveltekit (client) 53.57 kB - -
@sentry/core/server 44.8 kB - -
@sentry/core/browser 14.4 kB - -
@sentry/node 151.36 kB -0.01% -6 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.3 kB - -
@sentry/node - without tracing 88.56 kB -0.01% -6 B 🔽
@sentry/node - without channel injection 140.3 kB -0.01% -5 B 🔽
@sentry/aws-serverless 98.93 kB -0.01% -7 B 🔽
@sentry/cloudflare (withSentry) - minified 206.47 kB - -
@sentry/cloudflare (withSentry) 479.22 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 231.83 kB - -

View base workflow run

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 4 not successful, 59 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Failing after 53s Details
❌ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Failing after 3m Details
❌ CI: Optional E2E Tests / E2E nextjs-16-cacheComponents (cloudflare) Test (optional) Failing after 10m Details
❌ CI: Optional E2E Tests / E2E node-mastra Test (optional) Failing after 1m Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 58s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 51s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-orpc Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E react-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-eve (content off, latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 39s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (latest) Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 53s Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 30s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E astro-7-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Successful in 24s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry-static Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E node-eve (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Successful in 24s Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 34s Details
✅ CI: Optional E2E Tests / E2E nextjs-14 (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E vue-3 (no Options API) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 38s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E supabase-nextjs Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 59s Details
✅ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Successful in 1m Details

@linear-code

linear-code Bot commented Oct 30, 2026

Copy link
Copy Markdown

JS-3999

…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
wedamija marked this pull request as ready for review November 3, 2026 19:49
@wedamija
wedamija requested review from a team as code owners November 3, 2026 19:49
@wedamija
wedamija requested review from andreiborza, mydea, nicohrubec and s1gr1d and removed request for a team November 3, 2026 19:49
@wedamija
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.
@wedamija
wedamija marked this pull request as ready for review November 3, 2026 22:13
@wedamija
wedamija requested a review from a team as a code owner November 3, 2026 22:13
@wedamija
wedamija requested review from logaretm and removed request for a team November 3, 2026 22:13

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.
@s1gr1d
s1gr1d requested a review from isaacs November 10, 2026 14:34
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>
@wedamija
wedamija requested a review from a team November 11, 2026 19:05
wedamija and others added 4 commits November 11, 2026 11:18
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>
Comment thread CHANGELOG.md Resolved
Comment thread packages/server-utils/src/index.ts Resolved
wedamija and others added 4 commits November 12, 2026 13:43
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>
Comment thread packages/node/src/cron/node-cron.ts Resolved
@wedamija
wedamija merged commit b0d77ee into develop Nov 16, 2026
461 of 465 checks passed
@wedamija
wedamija deleted the danf/shared-cron-converter branch November 16, 2026 22:24
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants