Skip to content

feat(spring): Send monitor config from @Scheduled with @SentryCheckIn - #6215

Merged
wedamija merged 19 commits into
mainfrom
danf/spring-checkin-scheduled-config
Nov 5, 2026
Merged

wedamija merged 19 commits into
mainfrom
danf/spring-checkin-scheduled-config

Conversation

@wedamija

@wedamija wedamija commented Oct 2, 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.

@SentryCheckIn methods now send the schedule from their @Scheduled annotation as the monitor config, so Sentry creates the monitor on the first check-in and updates its schedule when the code changes. It's on by default, since @SentryCheckIn is already an opt-in to monitoring. On upgrade, existing monitors take their schedule and time zone from @Scheduled (the JVM zone when zone isn't set). The change is the same in sentry-spring, sentry-spring-jakarta and sentry-spring-7.

@Scheduled(cron = "0 0 * * * *")
@SentryCheckIn("hourly-sync")
void sync() { ... }

// keep managing the schedule in Sentry
@SentryCheckIn(value = "hourly-sync", upsertMonitorConfig = false)

Fixed-delay schedules and crons Sentry would read differently from Spring check in without a config. Heartbeat check-ins never send one.

Stacked on #6217.
Docs: getsentry/sentry-docs#19780

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 67b6f8b

@sentry

sentry Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.63.0 (1) release

⚙️ sentry-android Build Distribution Settings

…figs

Framework-free conversion of a 6 field cron expression, fixed rate or
fixed delay into a MonitorConfig, plus period parsing, so the Spring and
Quartz integrations can share it.
@wedamija
wedamija changed the base branch from main to danf/monitor-config-utils October 2, 2026 19:54
wedamija and others added 5 commits October 2, 2026 13:30
Return no config when day of month and day of week are both set, for
cron syntax Sentry rejects, and for zones that are not IANA region IDs.
Whole-hour fixed offsets map to Etc/GMT zones. Intervals use hours or
days when they divide evenly.
Move the Spring day-of-week rewrite and the JVM default zone rule into
core so the three Spring modules share them.
Spring and Quartz run 10-10/2 only at 10, cronsim steps to the field max.
Spring before 5.3 steps day of month */n from 0 and can run at midnight
when both day fields are set; read its crons that way. Spring 5.3 runs
#5 in months without a fifth weekday, so return null for it. A fixed
delay drifts from any interval, so it gets no config.
Co-Authored-By: Claude <noreply@anthropic.com>
@wedamija
wedamija force-pushed the danf/spring-checkin-scheduled-config branch from ff1e1e2 to 5d745c7 Compare October 5, 2026 22:54
Co-Authored-By: Claude <noreply@anthropic.com>
@wedamija
wedamija marked this pull request as ready for review October 5, 2026 23:28
Co-Authored-By: Claude <noreply@anthropic.com>

@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.

Reviewed by Cursor Bugbot for commit 6f5ad4e. Configure here.

wedamija and others added 3 commits October 5, 2026 17:43
SUN-SUN was rewritten to 0-7, which crontab reads as every day.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

JAVA-525

@wedamija
wedamija requested a review from a team as a code owner October 29, 2026 18:32
Dropping a non-zero seconds field makes check-ins arrive up to 59s after
the expected minute, which a 1 minute margin barely covers.
…like Spring

Existing @SentryCheckIn users shouldn't have their monitors changed on upgrade,
so sending the schedule is opt-in. Find @scheduled with Spring's own lookup so
an overriding method doesn't inherit a parent's schedule.
Base automatically changed from danf/monitor-config-utils to main November 5, 2026 18:38
@wedamija
wedamija enabled auto-merge (squash) November 5, 2026 18:41
@wedamija
wedamija merged commit 573cf8f into main Nov 5, 2026
44 checks passed
@wedamija
wedamija deleted the danf/spring-checkin-scheduled-config branch November 5, 2026 19:51
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