File tree Expand file tree Collapse file tree 6 files changed +63
-3
lines changed
main/java/io/sentry/spring/boot4
test/kotlin/io/sentry/spring/boot4
sentry-spring-boot-jakarta/src
main/java/io/sentry/spring/boot/jakarta
test/kotlin/io/sentry/spring/boot/jakarta
main/java/io/sentry/spring/boot
test/kotlin/io/sentry/spring/boot Expand file tree Collapse file tree 6 files changed +63
-3
lines changed Original file line number Diff line number Diff line change 77import org .springframework .context .annotation .Import ;
88
99@ Configuration (proxyBeanMethods = false )
10- @ ConditionalOnClass (name = {"io.sentry.opentelemetry.agent.AgentMarker" })
10+ @ ConditionalOnClass (
11+ name = {
12+ "io.sentry.opentelemetry.agent.AgentMarker" ,
13+ "io.sentry.asyncprofiler.profiling.JavaContinuousProfiler"
14+ })
1115@ Open
1216@ Import (SentryProfilerConfiguration .class )
1317public class SentryProfilerAutoConfiguration {}
Original file line number Diff line number Diff line change @@ -1133,6 +1133,22 @@ class SentryAutoConfigurationTest {
11331133 }
11341134 }
11351135
1136+ @Test
1137+ fun `when JavaContinuousProfiler is not on the classpath and ContinuousProfiling is enabled IProfileConverter beans are not created` () {
1138+ SentryIntegrationPackageStorage .getInstance().clearStorage()
1139+ contextRunner
1140+ .withPropertyValues(
1141+ " sentry.dsn=http://key@localhost/proj" ,
1142+ " sentry.profile-session-sample-rate=1.0" ,
1143+ " debug=true" ,
1144+ )
1145+ .withClassLoader(FilteredClassLoader (JavaContinuousProfiler ::class .java))
1146+ .run {
1147+ assertThat(it).doesNotHaveBean(IContinuousProfiler ::class .java)
1148+ assertThat(it).doesNotHaveBean(IProfileConverter ::class .java)
1149+ }
1150+ }
1151+
11361152 @Configuration(proxyBeanMethods = false )
11371153 open class CustomSchedulerFactoryBeanCustomizerConfiguration {
11381154 class MyJobListener : JobListener {
Original file line number Diff line number Diff line change 77import org .springframework .context .annotation .Import ;
88
99@ Configuration (proxyBeanMethods = false )
10- @ ConditionalOnClass (name = {"io.sentry.opentelemetry.agent.AgentMarker" })
10+ @ ConditionalOnClass (
11+ name = {
12+ "io.sentry.opentelemetry.agent.AgentMarker" ,
13+ "io.sentry.asyncprofiler.profiling.JavaContinuousProfiler"
14+ })
1115@ Open
1216@ Import (SentryProfilerConfiguration .class )
1317public class SentryProfilerAutoConfiguration {}
Original file line number Diff line number Diff line change @@ -1155,6 +1155,22 @@ class SentryAutoConfigurationTest {
11551155 }
11561156 }
11571157
1158+ @Test
1159+ fun `when JavaContinuousProfiler is not on the classpath and ContinuousProfiling is enabled IProfileConverter beans are not created` () {
1160+ SentryIntegrationPackageStorage .getInstance().clearStorage()
1161+ contextRunner
1162+ .withPropertyValues(
1163+ " sentry.dsn=http://key@localhost/proj" ,
1164+ " sentry.profile-session-sample-rate=1.0" ,
1165+ " debug=true" ,
1166+ )
1167+ .withClassLoader(FilteredClassLoader (JavaContinuousProfiler ::class .java))
1168+ .run {
1169+ assertThat(it).doesNotHaveBean(IContinuousProfiler ::class .java)
1170+ assertThat(it).doesNotHaveBean(IProfileConverter ::class .java)
1171+ }
1172+ }
1173+
11581174 @Configuration(proxyBeanMethods = false )
11591175 open class CustomSchedulerFactoryBeanCustomizerConfiguration {
11601176 class MyJobListener : JobListener {
Original file line number Diff line number Diff line change 77import org .springframework .context .annotation .Import ;
88
99@ Configuration (proxyBeanMethods = false )
10- @ ConditionalOnClass (name = {"io.sentry.opentelemetry.agent.AgentMarker" })
10+ @ ConditionalOnClass (
11+ name = {
12+ "io.sentry.opentelemetry.agent.AgentMarker" ,
13+ "io.sentry.asyncprofiler.profiling.JavaContinuousProfiler"
14+ })
1115@ Open
1216@ Import (SentryProfilerConfiguration .class )
1317public class SentryProfilerAutoConfiguration {}
Original file line number Diff line number Diff line change @@ -1006,6 +1006,22 @@ class SentryAutoConfigurationTest {
10061006 }
10071007 }
10081008
1009+ @Test
1010+ fun `when JavaContinuousProfiler is not on the classpath and ContinuousProfiling is enabled IProfileConverter beans are not created` () {
1011+ SentryIntegrationPackageStorage .getInstance().clearStorage()
1012+ contextRunner
1013+ .withPropertyValues(
1014+ " sentry.dsn=http://key@localhost/proj" ,
1015+ " sentry.profile-session-sample-rate=1.0" ,
1016+ " debug=true" ,
1017+ )
1018+ .withClassLoader(FilteredClassLoader (JavaContinuousProfiler ::class .java))
1019+ .run {
1020+ assertThat(it).doesNotHaveBean(IContinuousProfiler ::class .java)
1021+ assertThat(it).doesNotHaveBean(IProfileConverter ::class .java)
1022+ }
1023+ }
1024+
10091025 @Test
10101026 fun `creates quartz config` () {
10111027 contextRunner.withPropertyValues(" sentry.dsn=http://key@localhost/proj" ).run {
You can’t perform that action at this time.
0 commit comments