Do not attempt to instrument websocket upgrade handlers (DataDog/dd-trace-java#1567)
MODIFY
instrumentation/play-ws/play-ws-1.0/src/main/java/io/opentelemetry/auto/instrumentation/playws/v1_0/PlayWSClientInstrumentation.java
instrumentation/play-ws/play-ws-1.0/src/main/java/io/opentelemetry/auto/instrumentation/playws/v1_0/PlayWSClientInstrumentation.java
@@ -31,6 +31,7 @@ import net.bytebuddy.asm.Advice;
import play.shaded.ahc.org.asynchttpclient.AsyncHandler;
import play.shaded.ahc.org.asynchttpclient.Request;
import play.shaded.ahc.org.asynchttpclient.handler.StreamedAsyncHandler;
+import play.shaded.ahc.org.asynchttpclient.ws.WebSocketUpgradeHandler;
@AutoService(Instrumenter.class)
public class PlayWSClientInstrumentation extends BasePlayWSClientInstrumentation {
@@ -50,7 +51,8 @@ public class PlayWSClientInstrumentation extends BasePlayWSClientInstrumentation
if (asyncHandler instanceof StreamedAsyncHandler) {
asyncHandler = new StreamedAsyncHandlerWrapper((StreamedAsyncHandler) asyncHandler, span);
- } else {
+ } else if (!(asyncHandler instanceof WebSocketUpgradeHandler)) {
+ // websocket upgrade handlers aren't supported
asyncHandler = new AsyncHandlerWrapper(asyncHandler, span);
}

MODIFY
instrumentation/play-ws/play-ws-2.0/src/main/java/io/opentelemetry/auto/instrumentation/playws/v2_0/PlayWSClientInstrumentation.java
instrumentation/play-ws/play-ws-2.0/src/main/java/io/opentelemetry/auto/instrumentation/playws/v2_0/PlayWSClientInstrumentation.java
@@ -31,6 +31,7 @@ import net.bytebuddy.asm.Advice;
import play.shaded.ahc.org.asynchttpclient.AsyncHandler;
import play.shaded.ahc.org.asynchttpclient.Request;
import play.shaded.ahc.org.asynchttpclient.handler.StreamedAsyncHandler;
+import play.shaded.ahc.org.asynchttpclient.ws.WebSocketUpgradeHandler;
@AutoService(Instrumenter.class)
public class PlayWSClientInstrumentation extends BasePlayWSClientInstrumentation {
@@ -51,7 +52,8 @@ public class PlayWSClientInstrumentation extends BasePlayWSClientInstrumentation
if (asyncHandler instanceof StreamedAsyncHandler) {
asyncHandler = new StreamedAsyncHandlerWrapper((StreamedAsyncHandler) asyncHandler, span);
- } else {
+ } else if (!(asyncHandler instanceof WebSocketUpgradeHandler)) {
+ // websocket upgrade handlers aren't supported
asyncHandler = new AsyncHandlerWrapper(asyncHandler, span);
}

MODIFY
instrumentation/play-ws/play-ws-2.1/src/main/java/io/opentelemetry/auto/instrumentation/playws/v2_1/PlayWSClientInstrumentation.java
instrumentation/play-ws/play-ws-2.1/src/main/java/io/opentelemetry/auto/instrumentation/playws/v2_1/PlayWSClientInstrumentation.java
@@ -31,6 +31,7 @@ import net.bytebuddy.asm.Advice;
import play.shaded.ahc.org.asynchttpclient.AsyncHandler;
import play.shaded.ahc.org.asynchttpclient.Request;
import play.shaded.ahc.org.asynchttpclient.handler.StreamedAsyncHandler;
+import play.shaded.ahc.org.asynchttpclient.ws.WebSocketUpgradeHandler;
@AutoService(Instrumenter.class)
public class PlayWSClientInstrumentation extends BasePlayWSClientInstrumentation {
@@ -51,7 +52,8 @@ public class PlayWSClientInstrumentation extends BasePlayWSClientInstrumentation
if (asyncHandler instanceof StreamedAsyncHandler) {
asyncHandler = new StreamedAsyncHandlerWrapper((StreamedAsyncHandler) asyncHandler, span);
- } else {
+ } else if (!(asyncHandler instanceof WebSocketUpgradeHandler)) {
+ // websocket upgrade handlers aren't supported
asyncHandler = new AsyncHandlerWrapper(asyncHandler, span);
}

Do not attempt to instrument websocket upgrade handlers (DataDog/dd-trace-java#1567)