diff --git a/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts b/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts index d240b20049e3..7191cd4e8e04 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts +++ b/instrumentation/spring/spring-boot-autoconfigure/build.gradle.kts @@ -9,6 +9,8 @@ group = "io.opentelemetry.instrumentation" val versions: Map by project val springBootVersion = versions["org.springframework.boot"] +// R2DBC is shadowed to prevent org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration +// from being loaded by Spring Boot - even if the user doesn't want to use R2DBC. sourceSets { main { val shadedDep = project(":instrumentation:r2dbc-1.0:library-instrumentation-shaded") diff --git a/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/resource-config.json b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/resource-config.json new file mode 100644 index 000000000000..58a8e28876bc --- /dev/null +++ b/instrumentation/spring/spring-boot-autoconfigure/src/main/resources/META-INF/native-image/io.opentelemetry.instrumentation/opentelemetry-spring-boot/resource-config.json @@ -0,0 +1,9 @@ +{ + "resources": { + "includes": [ + { + "pattern": "META-INF/io/opentelemetry/instrumentation/.*.properties" + } + ] + } +} diff --git a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/InstrumentationTestRunner.java b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/InstrumentationTestRunner.java index be278d9c9fb5..f0ad986839f3 100644 --- a/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/InstrumentationTestRunner.java +++ b/testing-common/src/main/java/io/opentelemetry/instrumentation/testing/InstrumentationTestRunner.java @@ -122,12 +122,18 @@ private > void waitAndAssertTraces( try { await() .untilAsserted(() -> doAssertTraces(traceComparator, assertionsList, verifyScopeVersion)); - } catch (ConditionTimeoutException e) { - // Don't throw this failure since the stack is the awaitility thread, causing confusion. - // Instead, just assert one more time on the test thread, which will fail with a better stack - // trace. - // TODO(anuraaga): There is probably a better way to do this. - doAssertTraces(traceComparator, assertionsList, verifyScopeVersion); + } catch (Throwable t) { + // from org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:157) + // see https://github.com/oracle/graal/issues/6101 (spring boot graal native image) + if (t.getClass().getName().equals("com.oracle.svm.core.jdk.UnsupportedFeatureError") || t instanceof ConditionTimeoutException) { + // Don't throw this failure since the stack is the awaitility thread, causing confusion. + // Instead, just assert one more time on the test thread, which will fail with a better stack + // trace. + // TODO(anuraaga): There is probably a better way to do this. + doAssertTraces(traceComparator, assertionsList, verifyScopeVersion); + } else { + throw t; + } } }