From 21f927bd8f38affd3912cc78621f318530330003 Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Tue, 5 Sep 2023 12:36:03 +0200 Subject: [PATCH 1/5] add property to disable AOP related features that break graalvm build --- .../src/main/resources/application.properties | 5 +++++ .../sentry/spring/boot/jakarta/SentryAutoConfiguration.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties index 8151eacc6cf..75f030786c8 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties @@ -13,6 +13,11 @@ sentry.enable-tracing=true sentry.debug=true in-app-includes="io.sentry.samples" +# Uncomment and set to true to enable aot compatibility +# This is disables all AOP related features (i.e. @SentryTransaction, @SentrySpan) +# to successfully compile to GraalVM +# sentry.enable-aot-compatibility=false + # Database configuration spring.datasource.url=jdbc:p6spy:hsqldb:mem:testdb spring.datasource.driver-class-name=com.p6spy.engine.spy.P6SpyDriver diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java index 3ca17f75b4e..d3b071c1e8a 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java @@ -273,6 +273,10 @@ public FilterRegistrationBean sentryTracingFilter( } @Configuration(proxyBeanMethods = false) + @ConditionalOnProperty( + value = "sentry.enable-aot-compatibility", + havingValue = "false", + matchIfMissing = true) @Conditional(SentryTracingCondition.class) @ConditionalOnClass(ProceedingJoinPoint.class) @Import(SentryAdviceConfiguration.class) From 1a77ca4b3a2569aa0b8eeae991e9cb0c7363c356 Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Tue, 5 Sep 2023 14:58:46 +0200 Subject: [PATCH 2/5] add changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7427a063c28..d7f336c81d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ - Send `http.request.method` in span data ([#2896](https://github.com/getsentry/sentry-java/pull/2896)) - Add `enablePrettySerializationOutput` option for opting out of pretty print ([#2871](https://github.com/getsentry/sentry-java/pull/2871)) +### Fixes + +- Add `sentry.enable-aot-compatibility` property to SpringBoot Jakarta `SentryAutoConfiguration` to enable building for GraalVM ([#2915](https://github.com/getsentry/sentry-java/pull/2915)) + ## 6.28.0 ### Features From ac9de10e5af92cbd54c9cfdf4a93d313936fa908 Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Wed, 6 Sep 2023 11:23:27 +0200 Subject: [PATCH 3/5] add enableAotCompatibility flag to SentryProperties --- .../sentry/spring/boot/jakarta/SentryProperties.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java index 6b263a3303f..56535b5b184 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java @@ -33,6 +33,8 @@ public class SentryProperties extends SentryOptions { /** Reactive framework (e.g. WebFlux) integration properties */ private @NotNull Reactive reactive = new Reactive(); + private boolean enableAotCompatibility = false; + public boolean isUseGitCommitIdAsRelease() { return useGitCommitIdAsRelease; } @@ -85,6 +87,14 @@ public void setReactive(@NotNull Reactive reactive) { this.reactive = reactive; } + public boolean isEnableAotCompatibility() { + return enableAotCompatibility; + } + + public void setEnableAotCompatibility(boolean enableAotCompatibility) { + this.enableAotCompatibility = enableAotCompatibility; + } + @Open public static class Logging { /** Enable/Disable logging auto-configuration. */ From cc6972c0be4fe220fbd5de2b88055f4f20c2ac0b Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Mon, 11 Sep 2023 16:51:01 +0200 Subject: [PATCH 4/5] add comment, fix changelog --- CHANGELOG.md | 8 ++++---- .../src/main/resources/application.properties | 2 +- .../io/sentry/spring/boot/jakarta/SentryProperties.java | 5 +++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18155f4e1cd..726210f73ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixes + +- Add `sentry.enable-aot-compatibility` property to SpringBoot Jakarta `SentryAutoConfiguration` to enable building for GraalVM ([#2915](https://github.com/getsentry/sentry-java/pull/2915)) + ### Dependencies - Bump Gradle from v8.2.1 to v8.3.0 ([#2900](https://github.com/getsentry/sentry-java/pull/2900)) @@ -17,10 +21,6 @@ - Send `http.request.method` in span data ([#2896](https://github.com/getsentry/sentry-java/pull/2896)) - Add `enablePrettySerializationOutput` option for opting out of pretty print ([#2871](https://github.com/getsentry/sentry-java/pull/2871)) -### Fixes - -- Add `sentry.enable-aot-compatibility` property to SpringBoot Jakarta `SentryAutoConfiguration` to enable building for GraalVM ([#2915](https://github.com/getsentry/sentry-java/pull/2915)) - ## 6.28.0 ### Features diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties index 75f030786c8..37c9f988fe5 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties @@ -14,7 +14,7 @@ sentry.debug=true in-app-includes="io.sentry.samples" # Uncomment and set to true to enable aot compatibility -# This is disables all AOP related features (i.e. @SentryTransaction, @SentrySpan) +# This flag disables all AOP related features (i.e. @SentryTransaction, @SentrySpan) # to successfully compile to GraalVM # sentry.enable-aot-compatibility=false diff --git a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java index 56535b5b184..f5c485b402b 100644 --- a/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java +++ b/sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryProperties.java @@ -33,6 +33,11 @@ public class SentryProperties extends SentryOptions { /** Reactive framework (e.g. WebFlux) integration properties */ private @NotNull Reactive reactive = new Reactive(); + /** + * If set to true, this flag disables all AOP related features (e.g. {@link + * io.sentry.spring.jakarta.tracing.SentryTransaction}, {@link + * io.sentry.spring.jakarta.tracing.SentrySpan}) to successfully compile to GraalVM + */ private boolean enableAotCompatibility = false; public boolean isUseGitCommitIdAsRelease() { From fb6376c4660cef57a93dd4995b814a263eacf5be Mon Sep 17 00:00:00 2001 From: Lukas Bloder Date: Tue, 12 Sep 2023 08:30:08 +0200 Subject: [PATCH 5/5] update api --- sentry-spring-boot-jakarta/api/sentry-spring-boot-jakarta.api | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sentry-spring-boot-jakarta/api/sentry-spring-boot-jakarta.api b/sentry-spring-boot-jakarta/api/sentry-spring-boot-jakarta.api index 49141a82bb9..8611bbf0a2d 100644 --- a/sentry-spring-boot-jakarta/api/sentry-spring-boot-jakarta.api +++ b/sentry-spring-boot-jakarta/api/sentry-spring-boot-jakarta.api @@ -24,7 +24,9 @@ public class io/sentry/spring/boot/jakarta/SentryProperties : io/sentry/SentryOp public fun getLogging ()Lio/sentry/spring/boot/jakarta/SentryProperties$Logging; public fun getReactive ()Lio/sentry/spring/boot/jakarta/SentryProperties$Reactive; public fun getUserFilterOrder ()Ljava/lang/Integer; + public fun isEnableAotCompatibility ()Z public fun isUseGitCommitIdAsRelease ()Z + public fun setEnableAotCompatibility (Z)V public fun setExceptionResolverOrder (I)V public fun setLogging (Lio/sentry/spring/boot/jakarta/SentryProperties$Logging;)V public fun setReactive (Lio/sentry/spring/boot/jakarta/SentryProperties$Reactive;)V