quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

Native image problem with open telemetry and software.amazon.awssdk.services.sqs.model.MessageAttributeValue

Open DawidStuzynski opened this issue 10 months ago • 8 comments

Describe the bug

Hi, during executing native tests I am getting this error

com.oracle.svm.core.util.UserError$UserException: Discovered unresolved type during parsing: software.amazon.awssdk.services.sqs.model.MessageAttributeValue. This error is reported at image build time because class io.opentelemetry.instrumentation.awssdk.v2_2.SqsParentContext$MessageAttributeValueMapGetter is registered for linking at image build time by command line and command line.
========================================================================================================================
Error encountered while parsing io.opentelemetry.instrumentation.awssdk.v2_2.SqsParentContext$MessageAttributeValueMapGetter.get(SqsParentContext.java:33) 
Finished generating 'native-microservice-xray-1.0.0-SNAPSHOT-runner' in 31.9s.
Parsing context:
   at io.opentelemetry.extension.aws.AwsXrayPropagator.getContextFromHeader(AwsXrayPropagator.java:178)
   at io.opentelemetry.extension.aws.AwsXrayPropagator.extract(AwsXrayPropagator.java:173)
   at io.opentelemetry.instrumentation.api.instrumenter.PropagatingFromUpstreamInstrumenter.start(PropagatingFromUpstreamInstrumenter.java:30)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.InstrumenterVertxTracer.receiveRequest(InstrumenterVertxTracer.java:43)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.InstrumenterVertxTracer.receiveRequest(InstrumenterVertxTracer.java:19)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.OpenTelemetryVertxTracer.receiveRequest(OpenTelemetryVertxTracer.java:35)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.OpenTelemetryVertxTracer.receiveRequest(OpenTelemetryVertxTracer.java:16)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.OpenTelemetryVertxTracingFactory$VertxDelegator.receiveRequest(OpenTelemetryVertxTracingFactory.java:61)
   at io.vertx.core.http.impl.Http2ServerStream.onHeaders(Http2ServerStream.java:123)
   at io.vertx.core.http.impl.Http2ServerConnection.onHeadersRead(Http2ServerConnection.java:186)
   at io.vertx.core.http.impl.Http2ServerConnection.onHeadersRead(Http2ServerConnection.java:38)
   at io.vertx.core.http.impl.VertxHttp2ConnectionHandler.channelRead(VertxHttp2ConnectionHandler.java:416)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
   at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
   at io.netty.handler.codec.ByteToMessageDecoder.handlerRemoved(ByteToMessageDecoder.java:266)
   at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:537)
   at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469)
   at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:427)
   at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:394)
   at io.netty.handler.codec.ByteToMessageDecoder.userEventTriggered(ByteToMessageDecoder.java:386)
   at io.netty.handler.codec.http.HttpObjectDecoder.userEventTriggered(HttpObjectDecoder.java:610)
   at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:398)
   at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:376)
   at io.netty.channel.DefaultChannelPipeline.fireUserEventTriggered(DefaultChannelPipeline.java:913)
   at io.netty.channel.AbstractChannel$AbstractUnsafe.closeOutboundBufferForShutdown(AbstractChannel.java:674)
   at io.netty.channel.AbstractChannel$AbstractUnsafe.shutdownOutput(AbstractChannel.java:666)
   at io.netty.channel.AbstractChannel$AbstractUnsafe.handleWriteError(AbstractChannel.java:953)
   at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:933)
   at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:359)
   at io.netty.channel.nio.AbstractNioByteChannel$1.run(AbstractNioByteChannel.java:54)
   at io.quarkus.bootstrap.logging.QuarkusDelayedHandler.runCloseTasks(QuarkusDelayedHandler.java:318)
   at io.quarkus.bootstrap.logging.QuarkusDelayedHandler.clearHandlers(QuarkusDelayedHandler.java:240)
   at org.jboss.logmanager.ExtHandler.setHandlers(ExtHandler.java:231)
   at io.quarkus.bootstrap.logging.QuarkusDelayedHandler.setHandlers(QuarkusDelayedHandler.java:188)
   at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
   at io.quarkus.runtime.Application.start(Application.java:101)
   at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
   at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
   at com.oracle.svm.core.JavaMainWrapper.runCore0(JavaMainWrapper.java:237)
   at com.oracle.svm.core.JavaMainWrapper.doRun(JavaMainWrapper.java:293)
   at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
   at static root method.(Unknown Source)

Detailed message:

        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:85)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:248)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:814)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:592)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:550)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:539)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:721)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:143)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Discovered unresolved type during parsing: software.amazon.awssdk.services.sqs.model.MessageAttributeValue. This error is reported at image build time because class io.opentelemetry.instrumentation.awssdk.v2_2.SqsParentContext$MessageAttributeValueMapGetter is registered for linking at image build time by command line and command line.
Error encountered while parsing io.opentelemetry.instrumentation.awssdk.v2_2.SqsParentContext$MessageAttributeValueMapGetter.get(SqsParentContext.java:33) 
Parsing context:
   at io.opentelemetry.extension.aws.AwsXrayPropagator.getContextFromHeader(AwsXrayPropagator.java:178)
   at io.opentelemetry.extension.aws.AwsXrayPropagator.extract(AwsXrayPropagator.java:173)
   at io.opentelemetry.instrumentation.api.instrumenter.PropagatingFromUpstreamInstrumenter.start(PropagatingFromUpstreamInstrumenter.java:30)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.InstrumenterVertxTracer.receiveRequest(InstrumenterVertxTracer.java:43)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.InstrumenterVertxTracer.receiveRequest(InstrumenterVertxTracer.java:19)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.OpenTelemetryVertxTracer.receiveRequest(OpenTelemetryVertxTracer.java:35)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.OpenTelemetryVertxTracer.receiveRequest(OpenTelemetryVertxTracer.java:16)
   at io.quarkus.opentelemetry.runtime.tracing.intrumentation.vertx.OpenTelemetryVertxTracingFactory$VertxDelegator.receiveRequest(OpenTelemetryVertxTracingFactory.java:61)
   at io.vertx.core.http.impl.Http2ServerStream.onHeaders(Http2ServerStream.java:123)
   at io.vertx.core.http.impl.Http2ServerConnection.onHeadersRead(Http2ServerConnection.java:186)
   at io.vertx.core.http.impl.Http2ServerConnection.onHeadersRead(Http2ServerConnection.java:38)
   at io.vertx.core.http.impl.VertxHttp2ConnectionHandler.channelRead(VertxHttp2ConnectionHandler.java:416)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
   at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
   at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
   at io.netty.handler.codec.ByteToMessageDecoder.handlerRemoved(ByteToMessageDecoder.java:266)
   at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:537)
   at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469)
   at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:427)
   at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:394)
   at io.netty.handler.codec.ByteToMessageDecoder.userEventTriggered(ByteToMessageDecoder.java:386)
   at io.netty.handler.codec.http.HttpObjectDecoder.userEventTriggered(HttpObjectDecoder.java:610)
   at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:398)
   at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:376)
   at io.netty.channel.DefaultChannelPipeline.fireUserEventTriggered(DefaultChannelPipeline.java:913)
   at io.netty.channel.AbstractChannel$AbstractUnsafe.closeOutboundBufferForShutdown(AbstractChannel.java:674)
   at io.netty.channel.AbstractChannel$AbstractUnsafe.shutdownOutput(AbstractChannel.java:666)
   at io.netty.channel.AbstractChannel$AbstractUnsafe.handleWriteError(AbstractChannel.java:953)
   at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:933)
   at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:359)
   at io.netty.channel.nio.AbstractNioByteChannel$1.run(AbstractNioByteChannel.java:54)
   at io.quarkus.bootstrap.logging.QuarkusDelayedHandler.runCloseTasks(QuarkusDelayedHandler.java:318)
   at io.quarkus.bootstrap.logging.QuarkusDelayedHandler.clearHandlers(QuarkusDelayedHandler.java:240)
   at org.jboss.logmanager.ExtHandler.setHandlers(ExtHandler.java:231)
   at io.quarkus.bootstrap.logging.QuarkusDelayedHandler.setHandlers(QuarkusDelayedHandler.java:188)
   at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
   at io.quarkus.runtime.Application.start(Application.java:101)
   at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
   at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
   at com.oracle.svm.core.JavaMainWrapper.runCore0(JavaMainWrapper.java:237)
   at com.oracle.svm.core.JavaMainWrapper.doRun(JavaMainWrapper.java:293)
   at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
   at static root method.(Unknown Source)

Detailed message:

        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:809)
        ... 6 more
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: software.amazon.awssdk.services.sqs.model.MessageAttributeValue. This error is reported at image build time because class io.opentelemetry.instrumentation.awssdk.v2_2.SqsParentContext$MessageAttributeValueMapGetter is registered for linking at image build time by command line and command line.
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:550)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:544)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedType(SharedGraphBuilderPhase.java:436)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedCheckCast(SharedGraphBuilderPhase.java:338)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genCheckCast(BytecodeParser.java:4467)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genCheckCast(BytecodeParser.java:4460)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5449)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3431)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.iterateBytecodesForBlock(SharedGraphBuilderPhase.java:743)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3391)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3233)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1137)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.build(SharedGraphBuilderPhase.java:162)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1029)
        at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:101)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:116)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:434)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
        at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:146)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.parseGraph(AnalysisMethod.java:895)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsedHelper(AnalysisMethod.java:860)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:843)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.lookupEncodedGraph(InlineBeforeAnalysisGraphDecoder.java:175)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.doInline(PEGraphDecoder.java:1211)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.tryInline(PEGraphDecoder.java:1194)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.trySimplifyInvoke(PEGraphDecoder.java:1049)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.handleInvokeWithCallTarget(PEGraphDecoder.java:1001)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.handleInvoke(PEGraphDecoder.java:987)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.processNextNode(GraphDecoder.java:921)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysisGraphDecoder.processNextNode(InlineBeforeAnalysisGraphDecoder.java:344)
        at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.GraphDecoder.decode(GraphDecoder.java:650)
        at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.PEGraphDecoder.decode(PEGraphDecoder.java:892)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.phases.InlineBeforeAnalysis.decodeGraph(InlineBeforeAnalysis.java:76)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:195)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:621)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.createFlowsGraph(MethodTypeFlow.java:167)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureFlowsGraphCreated(MethodTypeFlow.java:153)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.MethodTypeFlow.getOrCreateMethodFlowsGraphInfo(MethodTypeFlow.java:111)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.typestate.DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultVirtualInvokeTypeFlow.java:114)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:620)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.PointsToAnalysis$1.run(PointsToAnalysis.java:491)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:187)
        at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:171)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

Expected behavior

I would expect to run tests without any problems. When I add my tests dependencies on implementation instead of testImplementation or I remove quarkus.sns.telemetry.enabled=true it works

Actual behavior

After running integration test, build is failing due to Discovered unresolved type during parsing: software.amazon.awssdk.services.sqs.model.MessageAttributeValue. This error is reported at image build time because class io.opentelemetry.instrumentation.awssdk.v2_2.SqsParentContext$MessageAttributeValueMapGetter is registered for linking at image build time by command line and command line.

How to Reproduce?

  1. Go to main branch of this repository: https://github.com/DawidStuzynski/native-microservice-xray
  2. Use this command to run integration tests: ./gradlew clean build -Dquarkus.package.type=native -Dquarkus.native.container-build=true quarkusIntTest

Output of uname -a or ver

Darwin Kernel Version 23.2.0: RELEASE_ARM64_T6020 arm64

Output of java -version

GraalVM CE 21.0.1+12.1

Mandrel or GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.9.4

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 8.6

Additional information

No response

DawidStuzynski avatar Apr 23 '24 14:04 DawidStuzynski

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel,native-image)

quarkus-bot[bot] avatar Apr 23 '24 14:04 quarkus-bot[bot]

I've reproduced it locally, looking into it.

galderz avatar Apr 25 '24 12:04 galderz

The fix you need is implementation("io.quarkiverse.amazonservices:quarkus-amazon-sqs:2.+"). That dependency cannot be test only because there is opentelemetry API in the runtime classpath that depends on that.

galderz avatar Apr 25 '24 12:04 galderz

Hello @galderz I work together with @DawidStuzynski We also found that scope from test to implementation works. In our case, SQS dependency is coming from our test library, so using it as implementation is rather non an option. Real aplication is not using SQS, just in test scope to do assertions( we read data from sns by using sqs). Also in jar build we do not have this issue.

adampoplawski avatar Apr 25 '24 18:04 adampoplawski

So, this is not a bug per se... we have link at build time enabled... so we won't allow incomplete class path... the thing is that the "generic" io.opentelemetry.instrumentation.awssdk.v2_2.AwsSdkTelemetry and io.opentelemetry.instrumentation.awssdk.v2_2.AwsSdkInstrumenterFactory used to create AWS SDK interceptors for OpenTelemetry usage actually has a SQS stuff all over the place...

image image

So even though you are not using SQS, the OTEL AWS SDK instrumentation lib is trying to use SQS lib stuff.. the easy way of solving this is just adding SQS to the classpath as @galderz suggested or try to follow https://quarkus.io/version/main/guides/native-reference#i-get-a-analysiserrorparsingerror-when-building-a-native-executable-due-to-an-unresolvedelementexception-what-can-i-do ... you can try to write GraalVM substitutions... the thing is that you will have a lot of stuff and code to write and maintain...

luneo7 avatar Apr 25 '24 19:04 luneo7

So the flow is in your case: 1 - Tell to instrument SNS with OTEL (quarkus.sns.telemetry.enabled=true) 2 - AmazonClientOpenTelemetryRecorder for SNS will create the AwsClientBuilder setting .addExecutionInterceptor(AwsSdkTelemetry.create(openTelemetry).newExecutionInterceptor()) 3 - AwsSdkTelemetry then calls AwsSdkInstrumenterFactory 4 - AwsSdkInstrumenterFactory calls/use SqsParentContext And then we have unmet dependencies that are not allowed because of link at build time =]

luneo7 avatar Apr 25 '24 19:04 luneo7

If you are using Oracle you can add quarkus-jdbc-oracle and the error will be gone lol... joke aside you can probably ask the Quarkiverse Amazon Services maintainer to produce a NativeImageAllowIncompleteClasspathBuildItem if telemetry is enabled and SQS isn't in the class path... this might be the only way without too much changes, and without refactoring the OTEL third party lib...

luneo7 avatar Apr 26 '24 04:04 luneo7

@luneo7 @galderz Thank you for the analysis.

I would prefer not to disable linking at build time. Additionally, it seems that SNS is also necessary. In most cases (telemetry without sqs/sns), we will produce NativeImageAllowIncompleteClasspathBuildItem, and the exception will become the rule. Moreover, this build item is undocumented and deprecated.

I'll attempt to add GraalVM substitutions, hoping for an easy solution.

For now, the solution is to add SQS to the runtime. I understand there will be a slight increase in binary size, but no bean will be produced if there is no injection point to be injected, so the memory footprint should not change, and no additional configuration should be needed for the SQS client.

I will continue on the issue opened at the extension repo. This one could be closed.

scrocquesel avatar Apr 27 '24 22:04 scrocquesel