File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
sentry-spring-7/src/main/java/io/sentry/spring7/webflux
sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux
sentry-spring/src/main/java/io/sentry/spring/webflux Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 1313 */
1414@ ApiStatus .Experimental
1515public final class SentryScheduleHook implements Function <Runnable , Runnable > {
16+
17+ /**
18+ * Runnable class names that should be excluded from scope forking. These are typically internal
19+ * scheduler loops that reschedule themselves indefinitely, which would cause memory issues due to
20+ * scope parent chain buildup.
21+ *
22+ * @see <a href="https://github.com/getsentry/sentry-java/issues/5051">GitHub Issue #5051</a>
23+ */
24+ private static final String [] EXCLUDED_RUNNABLE_PREFIXES = {
25+ "reactor.kafka.receiver.internals.ConsumerEventLoop"
26+ };
27+
1628 @ Override
1729 public Runnable apply (final @ NotNull Runnable runnable ) {
30+ final String runnableClassName = runnable .getClass ().getName ();
31+ for (final String excludedPrefix : EXCLUDED_RUNNABLE_PREFIXES ) {
32+ if (runnableClassName .startsWith (excludedPrefix )) {
33+ return runnable ;
34+ }
35+ }
36+
1837 final IScopes newScopes = Sentry .getCurrentScopes ().forkedCurrentScope ("spring.scheduleHook" );
1938
2039 return () -> {
Original file line number Diff line number Diff line change 1313 */
1414@ ApiStatus .Experimental
1515public final class SentryScheduleHook implements Function <Runnable , Runnable > {
16+
17+ /**
18+ * Runnable class names that should be excluded from scope forking. These are typically internal
19+ * scheduler loops that reschedule themselves indefinitely, which would cause memory issues due to
20+ * scope parent chain buildup.
21+ *
22+ * @see <a href="https://github.com/getsentry/sentry-java/issues/5051">GitHub Issue #5051</a>
23+ */
24+ private static final String [] EXCLUDED_RUNNABLE_PREFIXES = {
25+ "reactor.kafka.receiver.internals.ConsumerEventLoop"
26+ };
27+
1628 @ Override
1729 public Runnable apply (final @ NotNull Runnable runnable ) {
30+ final String runnableClassName = runnable .getClass ().getName ();
31+ for (final String excludedPrefix : EXCLUDED_RUNNABLE_PREFIXES ) {
32+ if (runnableClassName .startsWith (excludedPrefix )) {
33+ return runnable ;
34+ }
35+ }
36+
1837 final IScopes newScopes = Sentry .getCurrentScopes ().forkedCurrentScope ("spring.scheduleHook" );
1938
2039 return () -> {
Original file line number Diff line number Diff line change 1313 */
1414@ ApiStatus .Experimental
1515public final class SentryScheduleHook implements Function <Runnable , Runnable > {
16+
17+ /**
18+ * Runnable class names that should be excluded from scope forking. These are typically internal
19+ * scheduler loops that reschedule themselves indefinitely, which would cause memory issues due to
20+ * scope parent chain buildup.
21+ *
22+ * @see <a href="https://github.com/getsentry/sentry-java/issues/5051">GitHub Issue #5051</a>
23+ */
24+ private static final String [] EXCLUDED_RUNNABLE_PREFIXES = {
25+ "reactor.kafka.receiver.internals.ConsumerEventLoop"
26+ };
27+
1628 @ Override
1729 public Runnable apply (final @ NotNull Runnable runnable ) {
30+ final String runnableClassName = runnable .getClass ().getName ();
31+ for (final String excludedPrefix : EXCLUDED_RUNNABLE_PREFIXES ) {
32+ if (runnableClassName .startsWith (excludedPrefix )) {
33+ return runnable ;
34+ }
35+ }
36+
1837 final IScopes newScopes = Sentry .getCurrentScopes ().forkedCurrentScope ("spring.scheduleHook" );
1938
2039 return () -> {
You can’t perform that action at this time.
0 commit comments