Skip to content

Can't use @SpanAttribute annotation with Websockets.NEXT @OnTextMessage #43412

Open

Description

Describe the bug

When combining WebSockets.NEXT & OpenTelemetry, I can't seem to be able to add an @SpanAttribute annotation to a method parameter of an @OnTextMessage, like this:

@OnTextMessage
@WithSpan("ChatMessage")
public ClaimBotQueryResponse onMessage(@SpanAttribute("arg.chatQuery") ClaimBotQuery query) {
    Log.infof("Got chat query: %s", query);
    var response = new ClaimBotQueryResponse("token", this.bot.chat(query), "");
    Log.debugf("Got chat response: %s", response);

    return response;
}

Expected behavior

No response

Actual behavior

I get this error when trying to run dev mode:

2024-09-20 11:21:44,087 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.websockets.next.deployment.WebSocketProcessor#collectEndpoints threw an exception: io.quarkus.websockets.next.WebSocketException: Unable to inject @OnTextMessage callback parameter 'query' declared on org.parasol.resources.ClaimWebsocketChatBot#onMessage(): no injector found
        at io.quarkus.websockets.next.deployment.Callback.collectArguments(Callback.java:208)
        at io.quarkus.websockets.next.deployment.Callback.<init>(Callback.java:65)
        at io.quarkus.websockets.next.deployment.WebSocketProcessor.findCallback(WebSocketProcessor.java:1425)
        at io.quarkus.websockets.next.deployment.WebSocketProcessor.findCallback(WebSocketProcessor.java:1410)
        at io.quarkus.websockets.next.deployment.WebSocketProcessor.collectEndpoints(WebSocketProcessor.java:355)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at java.base/java.lang.Thread.run(Thread.java:1583)
        at org.jboss.threads.JBossThread.run(JBossThread.java:483)

        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:354)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:272)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:62)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:91)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:430)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:57)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
        at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.websockets.next.deployment.WebSocketProcessor#collectEndpoints threw an exception: io.quarkus.websockets.next.WebSocketException: Unable to inject @OnTextMessage callback parameter 'query' declared on org.parasol.resources.ClaimWebsocketChatBot#onMessage(): no injector found
        at io.quarkus.websockets.next.deployment.Callback.collectArguments(Callback.java:208)
        at io.quarkus.websockets.next.deployment.Callback.<init>(Callback.java:65)
        at io.quarkus.websockets.next.deployment.WebSocketProcessor.findCallback(WebSocketProcessor.java:1425)
        at io.quarkus.websockets.next.deployment.WebSocketProcessor.findCallback(WebSocketProcessor.java:1410)
        at io.quarkus.websockets.next.deployment.WebSocketProcessor.collectEndpoints(WebSocketProcessor.java:355)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at java.base/java.lang.Thread.run(Thread.java:1583)
        at org.jboss.threads.JBossThread.run(JBossThread.java:483)

        at io.quarkus.builder.Execution.run(Execution.java:123)
        at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:161)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:350)
        ... 9 more
Caused by: io.quarkus.websockets.next.WebSocketException: Unable to inject @OnTextMessage callback parameter 'query' declared on org.parasol.resources.ClaimWebsocketChatBot#onMessage(): no injector found
        at io.quarkus.websockets.next.deployment.Callback.collectArguments(Callback.java:208)
        at io.quarkus.websockets.next.deployment.Callback.<init>(Callback.java:65)
        at io.quarkus.websockets.next.deployment.WebSocketProcessor.findCallback(WebSocketProcessor.java:1425)
        at io.quarkus.websockets.next.deployment.WebSocketProcessor.findCallback(WebSocketProcessor.java:1410)
        at io.quarkus.websockets.next.deployment.WebSocketProcessor.collectEndpoints(WebSocketProcessor.java:355)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
        at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
        at java.base/java.lang.Thread.run(Thread.java:1583)
        at org.jboss.threads.JBossThread.run(JBossThread.java:483)

How to Reproduce?

Reproducer: parasol-insurance.zip

  1. Download & unzip reproducer
  2. cd parasol-insurance
  3. ./mvnw clean quarkus:dev
  4. Observe above stack trace

Output of uname -a or ver

Darwin edeandrea-m1pro 24.0.0 Darwin Kernel Version 24.0.0: Mon Aug 12 20:51:54 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "21.0.4" 2024-07-16 LTS
OpenJDK Runtime Environment Temurin-21.0.4+7 (build 21.0.4+7-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.4+7 (build 21.0.4+7-LTS, mixed mode)

Quarkus version or git rev

3.14.4

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

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /Users/edeandre/.m2/wrapper/dists/apache-maven-3.9.6/a53741d1
Java version: 21.0.4, vendor: Eclipse Adoptium, runtime: /Users/edeandre/.sdkman/candidates/java/21.0.4-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "15.0", arch: "aarch64", family: "mac"

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions