From fec70c10f12ba76bd3b07fc03305e1e8a538a29a Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Tue, 19 Mar 2024 11:13:24 +0200 Subject: [PATCH] Fix virtual thread instrumentation for jdk 21 ea versions --- .../executors/VirtualThreadInstrumentation.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instrumentation/executors/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/executors/VirtualThreadInstrumentation.java b/instrumentation/executors/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/executors/VirtualThreadInstrumentation.java index 8aad00eda23a..a348e0539e5e 100644 --- a/instrumentation/executors/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/executors/VirtualThreadInstrumentation.java +++ b/instrumentation/executors/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/executors/VirtualThreadInstrumentation.java @@ -32,7 +32,8 @@ public void transform(TypeTransformer transformer) { named("switchToCarrierThread").and(takesArguments(0)), this.getClass().getName() + "$SwitchToCarrierAdvice"); transformer.applyAdviceToMethod( - named("switchToVirtualThread").and(takesArguments(1)), + // takes an extra argument in jdk 21 ea versions + named("switchToVirtualThread").and(takesArguments(1).or(takesArguments(2))), this.getClass().getName() + "$SwitchToVirtualAdvice"); }