You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e29145a
Browse filesBrowse the repository at this point in the historyBrowse files
feat(spring): Add an option to monitor all @scheduled methods in Spring Boot 2 (#6276)
* ref(core): Add MonitorConfigUtils to convert schedules to monitor configs
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.
* fix(core): Only send monitor configs Sentry reads the same way
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.
* ref(core): Add MonitorConfigUtils.fromSpringScheduled
Move the Spring day-of-week rewrite and the JVM default zone rule into
core so the three Spring modules share them.
* fix(core): Return no config for stepped single value ranges
Spring and Quartz run 10-10/2 only at 10, cronsim steps to the field max.
* fix(core): Read Spring crons per parser and skip fixed delays
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.
* feat(spring): Send monitor config from @scheduled with @SentryCheckIn
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(spring): Send @scheduled monitor config by default
Co-Authored-By: Claude <noreply@anthropic.com>
* ref(spring): Shorten upsertMonitorConfig Javadoc
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(core): Keep Sunday-only day of week ranges
SUN-SUN was rewritten to 0-7, which crontab reads as every day.
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(spring): Only catch runtime exceptions when deriving monitor config
Co-Authored-By: Claude <noreply@anthropic.com>
* ref(spring): Shorten upsertMonitorConfig Javadoc
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(spring-jakarta): Monitor all @scheduled methods with sentry.monitor-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>
* changelog
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(spring): Monitor all @scheduled methods in Spring Boot 2
Co-Authored-By: Claude <noreply@anthropic.com>
* docs(changelog): Link Spring Boot 2 PR
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(spring-jakarta): Skip reactive @scheduled methods when monitoring 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>
* fix(spring): Skip reactive @scheduled methods when monitoring all tasks
Same fix as the Spring Boot 3 copy.
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(spring): Skip jobs with unsupported schedules when monitoring all jobs
* fix(spring): Skip jobs with unsupported schedules when monitoring all jobs
* ref(spring): Use pattern-matching instanceof for the @scheduled time unit
* fix(core): Use a 2 minute check-in margin for crons with fixed seconds
Dropping a non-zero seconds field makes check-ins arrive up to 59s after
the expected minute, which a 1 minute margin barely covers.
* fix(spring): Default upsertMonitorConfig to false and read @scheduled 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.
* fix(spring): Find @scheduled tasks to monitor the way Spring does
An overriding method without @scheduled isn't scheduled by Spring, so don't
monitor it either.
* fix(spring): Find @scheduled tasks to monitor the way Spring does
An overriding method without @scheduled isn't scheduled by Spring, so don't
monitor it either.
* feat(spring): Warn when two @scheduled methods share a monitor slug
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.
* feat(spring): Warn when two @scheduled methods share a monitor slug
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.
* ref(spring): Reuse the target class for the slug collision check
Use the same class for the task name and the collision check so both see one value.
* ref(spring): Reuse the target class for the slug collision check
Use the same class for the task name and the collision check so both see one value.
* fix(spring): Skip private and static @scheduled methods when monitoring 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.
* fix(spring): Skip private and static @scheduled methods when monitoring 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.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@
9
9
10
10
### Features
11
11
12
-
- Monitor every Spring `@Scheduled` method with Sentry Crons by setting `sentry.monitor-scheduled-tasks=true`, without adding `@SentryCheckIn` to each method. Sentry creates each monitor from the method's `@Scheduled` schedule. Exclude methods with `sentry.exclude-scheduled-tasks` ([#6275](https://github.com/getsentry/sentry-java/pull/6275))
12
+
- Monitor every Spring `@Scheduled` method with Sentry Crons by setting `sentry.monitor-scheduled-tasks=true`, without adding `@SentryCheckIn` to each method. Sentry creates each monitor from the method's `@Scheduled` schedule. Exclude methods with `sentry.exclude-scheduled-tasks` ([#6275](https://github.com/getsentry/sentry-java/pull/6275), [#6276](https://github.com/getsentry/sentry-java/pull/6276))
13
13
- Quartz `SentryJobListener` can send a monitor config derived from the trigger with check-ins, so Sentry creates or updates the monitor from code. Set the `sentry-upsert-monitor-config` job or trigger data key to `"true"` to send the schedule ([#6216](https://github.com/getsentry/sentry-java/pull/6216))
14
14
- Send a monitor config derived from Spring `@Scheduled` with `@SentryCheckIn` check-ins, so Sentry creates or updates the monitor from code. Set `@SentryCheckIn(upsertMonitorConfig = true)` to send the schedule ([#6215](https://github.com/getsentry/sentry-java/pull/6215))
Copy file name to clipboardExpand all lines: sentry-spring/api/sentry-spring.api
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -146,6 +146,7 @@ public abstract interface annotation class io/sentry/spring/checkin/SentryCheckI
146
146
public class io/sentry/spring/checkin/SentryCheckInAdvice : org/aopalliance/intercept/MethodInterceptor, org/springframework/context/EmbeddedValueResolverAware {
147
147
public fun <init> ()V
148
148
public fun <init> (Lio/sentry/IScopes;)V
149
+
public fun <init> (Lio/sentry/IScopes;Z)V
149
150
public fun invoke (Lorg/aopalliance/intercept/MethodInvocation;)Ljava/lang/Object;
150
151
public fun setEmbeddedValueResolver (Lorg/springframework/util/StringValueResolver;)V
151
152
}
@@ -166,6 +167,11 @@ public class io/sentry/spring/checkin/SentryQuartzConfiguration {
166
167
public fun schedulerFactoryBeanCustomizer ()Lorg/springframework/boot/autoconfigure/quartz/SchedulerFactoryBeanCustomizer;
167
168
}
168
169
170
+
public final class io/sentry/spring/checkin/SentryScheduledCheckInPointcut : org/springframework/aop/support/StaticMethodMatcherPointcut {
171
+
public fun <init> (Ljava/util/List;)V
172
+
public fun matches (Ljava/lang/reflect/Method;Ljava/lang/Class;)Z
173
+
}
174
+
169
175
public final class io/sentry/spring/checkin/SentrySchedulerFactoryBeanCustomizer : org/springframework/boot/autoconfigure/quartz/SchedulerFactoryBeanCustomizer {
170
176
public fun <init> ()V
171
177
public fun customize (Lorg/springframework/scheduling/quartz/SchedulerFactoryBean;)V
0 commit comments