Skip to content

feat(spring): Add an option to monitor all @Scheduled methods in Spring Boot 4 - #6277

Merged
wedamija merged 62 commits into
mainfrom
danf/spring-monitor-scheduled-tasks-boot4
Nov 5, 2026
Merged

wedamija merged 62 commits into
mainfrom
danf/spring-monitor-scheduled-tasks-boot4

Conversation

@wedamija

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

Same change as #6275 for Spring Boot 4 (sentry-spring-7 and sentry-spring-boot-4): sentry.monitor-scheduled-tasks and sentry.exclude-scheduled-tasks, with the same code and tests.

Stacked on #6276.

wedamija and others added 17 commits October 2, 2026 12:53
…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.
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>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
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>
…tor-scheduled-tasks

Adds sentry.monitor-scheduled-tasks and sentry.exclude-scheduled-tasks to
Spring Boot 3. Methods without @SentryCheckIn get a slug from the class
and method name and send their @scheduled schedule as the monitor config.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 17, 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 910cfbf

@sentry

sentry Bot commented Oct 17, 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

@wedamija wedamija changed the title feat(spring): Monitor all @Scheduled methods in Spring Boot 4 feat(spring): Add an option to monitor all @Scheduled methods in Spring Boot 4 Oct 20, 2026
wedamija and others added 5 commits October 20, 2026 10:46
… all tasks

Spring calls reactive and suspend @scheduled methods once at startup and
subscribes to the result on each run, so check-ins around the call would
only be sent once.

Co-Authored-By: Claude <noreply@anthropic.com>
Same fix as the Spring Boot 3 copy.

Co-Authored-By: Claude <noreply@anthropic.com>
…asks

Same fix as the Spring Boot 3 copy.

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

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

JAVA-789

…monitor-scheduled-tasks

# Conflicts:
#	CHANGELOG.md
An overriding method without @scheduled isn't scheduled by Spring, so don't
monitor it either.
…onitor-scheduled-tasks-boot2

# Conflicts:
#	CHANGELOG.md
An overriding method without @scheduled isn't scheduled by Spring, so don't
monitor it either.
…ring-monitor-scheduled-tasks-boot4

# Conflicts:
#	CHANGELOG.md
An overriding method without @scheduled isn't scheduled by Spring, so don't
monitor it either.
@wedamija
wedamija marked this pull request as ready for review November 5, 2026 19:45
@wedamija
wedamija requested a review from a team as a code owner November 5, 2026 19:45
@wedamija
wedamija requested review from romtsn and runningcode and removed request for a team November 5, 2026 19:45
…cheduled-tasks

# Conflicts:
#	CHANGELOG.md
#	sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/checkin/SentryCheckInAdvice.java
Derived slugs use only the short class name and method name, so different methods can map to the same slug and share one monitor. Log a warning the first time that happens so users can set an explicit slug.
…onitor-scheduled-tasks-boot2

# Conflicts:
#	CHANGELOG.md
Derived slugs use only the short class name and method name, so different methods can map to the same slug and share one monitor. Log a warning the first time that happens so users can set an explicit slug.
…ring-monitor-scheduled-tasks-boot4

# Conflicts:
#	CHANGELOG.md
Derived slugs use only the short class name and method name, so different methods can map to the same slug and share one monitor. Log a warning the first time that happens so users can set an explicit slug.
Use the same class for the task name and the collision check so both see one value.
Use the same class for the task name and the collision check so both see one value.
…ng all tasks

Spring invokes private and static scheduled methods on the target, so the proxy never sees them. Don't match them, so they aren't proxied for nothing.
…ng all tasks

Spring invokes private and static scheduled methods on the target, so the proxy never sees them. Don't match them, so they aren't proxied for nothing.
…ng all tasks

Spring invokes private and static scheduled methods on the target, so the proxy never sees them. Don't match them, so they aren't proxied for nothing.
Base automatically changed from danf/spring-monitor-scheduled-tasks-boot2 to main November 5, 2026 22:13
@wedamija
wedamija merged commit 8158e3c into main Nov 5, 2026
44 checks passed
@wedamija
wedamija deleted the danf/spring-monitor-scheduled-tasks-boot4 branch November 5, 2026 22:19
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