Open super7ramp opened 3 months ago
I stumbled upon this issue as well. It doesn't feel right to tune build process by having --initialize-at-build-time=x.y.x.package
(solution from my codebase) or --exclude-config
as the author pointed out.
any updates on this one? ETA?
@super7ramp maybe this ticket should be reported in different repo of the OTEL. This repo is just for the examples and maybe it doesn't have the traction and the attention.
@super7ramp could you please provide a link to the GraalVM you've used to successfully build this?
@jack-berg could this problem be related to the https://github.com/open-telemetry/opentelemetry-java/issues/6127 and similar solution as https://github.com/open-telemetry/opentelemetry-java/pull/6139 could be applied for the java instrumentation https://github.com/open-telemetry/opentelemetry-java-instrumentation?
cc @jeanbisutti
transferring to instrumentation repo at @jeanbisutti's request
@super7ramp Thank you for reporting this issue. We need to do changes in the OpenTelemetry starter to make it work without any user configuration.
spring-native example fails to build with GraalVM 22. It builds fine with GraalVM 21.
Errors found in build logs:
Full logs
``` spring-native % ../gradlew nativeCompile Picked up JAVA_TOOL_OPTIONS: > Task :opentelemetry-examples-spring-native:processAot Picked up JAVA_TOOL_OPTIONS: . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v3.3.1) 2024-07-21T13:42:10.932+02:00 INFO 46353 --- [ main] i.o.example.graal.Application : Starting Application using Java 21.0.1 with PID 46353 (/Users/57139H/dev/2-repos/opentelemetry-java-examples/spring-native/build/classes/java/main started by 57139H in /Users/57139H/dev/2-repos/opentelemetry-java-examples/spring-native) 2024-07-21T13:42:10.933+02:00 INFO 46353 --- [ main] i.o.example.graal.Application : No active profile set, falling back to 1 default profile: "default" 2024-07-21T13:42:11.310+02:00 INFO 46353 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode. 2024-07-21T13:42:11.317+02:00 INFO 46353 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 5 ms. Found 0 JDBC repository interfaces. > Task :opentelemetry-examples-spring-native:generateResourcesConfigFile [native-image-plugin] Resources configuration written into /Users/57139H/dev/2-repos/opentelemetry-java-examples/spring-native/build/native/generated/generateResourcesConfigFile/resource-config.json > Task :opentelemetry-examples-spring-native:nativeCompile [native-image-plugin] Quick build environment variable is set. [native-image-plugin] GraalVM Toolchain detection is disabled [native-image-plugin] GraalVM location read from environment variable: GRAALVM_HOME [native-image-plugin] Native Image executable path: /Users/57139H/Library/Java/JavaVirtualMachines/graalvm-jdk-22.0.2/Contents/Home/lib/svm/bin/native-image Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future. Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future. Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future. Warning: The option '-H:ReflectionConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-reflection.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future. Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-el/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future. Warning: The option '-H:ResourceConfigurationResources=META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-websocket/tomcat-resource.json' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future. Warning: Please re-evaluate whether any experimental option is required, and either remove or unlock it. The build output lists all active experimental options, including where they come from and possible alternatives. If you think an experimental option should be considered as stable, please file an issue. ======================================================================================================================== GraalVM Native Image: Generating 'opentelemetry-examples-spring-native' (shared library)... ======================================================================================================================== For detailed information and explanations on the build output, visit: https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md ------------------------------------------------------------------------------------------------------------------------ [1/8] Initializing... (5,2s @ 0,18GB) Java version: 22.0.2+9, vendor version: Oracle GraalVM 22.0.2+9.1 Graal compiler: optimization level: b, target machine: armv8-a, PGO: off C compiler: cc (apple, arm64, 15.0.0) Garbage collector: Serial GC (max heap size: 80% of RAM) 2 user-specific feature(s): - com.oracle.svm.thirdparty.gson.GsonFeature - org.springframework.aot.nativex.feature.PreComputeFieldFeature ------------------------------------------------------------------------------------------------------------------------ 2 experimental option(s) unlocked: - '-H:ResourceConfigurationResources': Use a resource-config.json in your META-INF/native-image/Adding
--trace-object-instantiation=io.opentelemetry.instrumentation.api.internal.cache.MapBackedCache
as suggested in the logs gives:Adding
--initialize-at-run-time=io.opentelemetry.instrumentation.logback.appender.v1_0.internal.LoggingEventMapper
gives:Excluding native configuration with the following arguments makes the build pass but I'm not sure it's the right thing to do: