Conversation
Derive a monitor config from the method's @scheduled annotation and send it with the in-progress check-in, so Sentry can create or update the monitor from code. Cron expressions with a fixed seconds field and fixed rates/delays in whole minutes are converted; other schedules send no config. Opt out with @SentryCheckIn(upsertMonitorConfig = false).
Contributor
|
📲 Install BuildsAndroid
|
…figs Framework-free conversion of a 6 field cron expression, fixed rate or fixed delay into a MonitorConfig, so the Spring modules can share it.
Keep only the Spring-specific part in the three advices (finding @scheduled, reading its attributes, resolving placeholders) and move the conversion edge-case tests to core.
This was referenced Oct 2, 2026
Add parsePeriodMillis for plain numbers and the 5m/30s style Spring 6.1 accepts, and make the cron macro map unmodifiable.
Spring runs a cron without zone in the JVM default time zone, so send that instead of leaving it to UTC. Accept simple duration periods, log unparseable ones at debug, and derive the config once per method.
3 of 9 tasks
Sending the monitor config changes existing behaviour, so it now needs @SentryCheckIn(upsertMonitorConfig = true).
…danf/spring-checkin-scheduled-config
Spring starts '*' on Monday and numbers Sunday 7, so '*/2' and 'SUN/2' meant different days in crontab. Day names become numbers. Cache the config with computeIfAbsent.
…danf/spring-checkin-scheduled-config
Keep only the Spring glue in each module and move the conversion rule tests to core.
Read crons the way CronSequenceGenerator does on Spring before 5.3. Derive the monitor config before the job's try block and catch any Throwable, so a failure there never skips the job. Fixed delays get no config.
This branch has not been deployed
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.
Stacked on #6217 (core
MonitorConfigUtils).Reviewing:
sentry-spring,sentry-spring-jakartaandsentry-spring-7get the same change apart from packages, so reviewsentry-spring; the other two are copies.📜 Description
With
@SentryCheckIn(upsertMonitorConfig = true)(opt-in, defaultfalse), the advice reads the method's@Scheduledand sends a monitor config with the in-progress check-in, so Sentry creates or updates the monitor from code.cron: converted byMonitorConfigUtils.fromSpringScheduled(ref(core): Add MonitorConfigUtils to convert schedules to monitor configs #6217) so crontab reads it like Spring. Spring before 5.3 parses crons differently, so the advice checks forCronExpressionand picks the matching rules. Thezone, or the JVM default zone, is sent as the timezone.fixedRate(includingfixedRateString, ISO-8601 durations andtimeUnit): an interval when it's a whole number of minutes.fixedDelaysends no config: the next run starts after the previous one ends, so it would raise false missed alerts.@Scheduled, and schedules that can't be converted send no config, as today.Sentry merges the config into an existing monitor. Margins, max runtime and thresholds set in the UI are kept unless
options.cronsets defaults for them, which are sent with every check-in.💡 Motivation and Context
Without a config, check-ins for monitors that weren't created in Sentry are dropped.
@Scheduledalready has the schedule.💚 How did you test it?
SentryCheckInAdviceTestin each Spring module. The conversion rules are tested in #6217.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Docs: getsentry/sentry-docs#19780