Separate out Akka ForkJoinPool instrumentation from java_concurrent (DataDog/dd-trace-java#1685)
RENAME
instrumentation/akka-context-propagation-2.5/src/main/java/io/opentelemetry/instrumentation/auto/akkaconcurrent/AkkaExecutorInstrumentation.java
instrumentation/akka-context-propagation-2.5/src/main/java/io/opentelemetry/instrumentation/auto/akkaconcurrent/AkkaForkJoinPoolInstrumentation.java
package io.opentelemetry.instrumentation.auto.akkaconcurrent;
-import static io.opentelemetry.javaagent.tooling.ClassLoaderMatcher.hasClassesNamed;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.nameMatches;
import static net.bytebuddy.matcher.ElementMatchers.named;
@@ -29,19 +28,19 @@ import io.opentelemetry.instrumentation.auto.api.ContextStore;
import io.opentelemetry.instrumentation.auto.api.InstrumentationContext;
import io.opentelemetry.instrumentation.auto.api.concurrent.ExecutorInstrumentationUtils;
import io.opentelemetry.instrumentation.auto.api.concurrent.State;
-import io.opentelemetry.instrumentation.auto.javaconcurrent.AbstractExecutorInstrumentation;
import io.opentelemetry.javaagent.tooling.Instrumenter;
import java.util.HashMap;
import java.util.Map;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
@AutoService(Instrumenter.class)
-public final class AkkaExecutorInstrumentation extends AbstractExecutorInstrumentation {
+public final class AkkaForkJoinPoolInstrumentation extends Instrumenter.Default {
- public AkkaExecutorInstrumentation() {
- super(AbstractExecutorInstrumentation.EXEC_NAME + ".akka_fork_join");
+ public AkkaForkJoinPoolInstrumentation() {
+ super("akka_context_propagation");
}
@Override
@@ -50,9 +49,9 @@ public final class AkkaExecutorInstrumentation extends AbstractExecutorInstrumen
}
@Override
- public ElementMatcher<ClassLoader> classLoaderMatcher() {
- // Optimization for expensive typeMatcher.
- return hasClassesNamed(AkkaForkJoinTaskInstrumentation.TASK_CLASS_NAME);
+ public ElementMatcher<TypeDescription> typeMatcher() {
+ // This might need to be an extendsClass matcher...
+ return named("akka.dispatch.forkjoin.ForkJoinPool");
}
@Override
@@ -66,15 +65,15 @@ public final class AkkaExecutorInstrumentation extends AbstractExecutorInstrumen
transformers.put(
named("execute")
.and(takesArgument(0, named(AkkaForkJoinTaskInstrumentation.TASK_CLASS_NAME))),
- AkkaExecutorInstrumentation.class.getName() + "$SetAkkaForkJoinStateAdvice");
+ AkkaForkJoinPoolInstrumentation.class.getName() + "$SetAkkaForkJoinStateAdvice");
transformers.put(
named("submit")
.and(takesArgument(0, named(AkkaForkJoinTaskInstrumentation.TASK_CLASS_NAME))),
- AkkaExecutorInstrumentation.class.getName() + "$SetAkkaForkJoinStateAdvice");
+ AkkaForkJoinPoolInstrumentation.class.getName() + "$SetAkkaForkJoinStateAdvice");
transformers.put(
nameMatches("invoke")
.and(takesArgument(0, named(AkkaForkJoinTaskInstrumentation.TASK_CLASS_NAME))),
- AkkaExecutorInstrumentation.class.getName() + "$SetAkkaForkJoinStateAdvice");
+ AkkaForkJoinPoolInstrumentation.class.getName() + "$SetAkkaForkJoinStateAdvice");
return transformers;
}

MODIFY
instrumentation/akka-context-propagation-2.5/src/main/java/io/opentelemetry/instrumentation/auto/akkaconcurrent/AkkaForkJoinTaskInstrumentation.java
instrumentation/akka-context-propagation-2.5/src/main/java/io/opentelemetry/instrumentation/auto/akkaconcurrent/AkkaForkJoinTaskInstrumentation.java
@@ -32,7 +32,6 @@ import io.opentelemetry.instrumentation.auto.api.ContextStore;
import io.opentelemetry.instrumentation.auto.api.InstrumentationContext;
import io.opentelemetry.instrumentation.auto.api.concurrent.AdviceUtils;
import io.opentelemetry.instrumentation.auto.api.concurrent.State;
-import io.opentelemetry.instrumentation.auto.javaconcurrent.AbstractExecutorInstrumentation;
import io.opentelemetry.javaagent.tooling.Instrumenter;
import java.util.Collections;
import java.util.HashMap;
@@ -55,7 +54,7 @@ public final class AkkaForkJoinTaskInstrumentation extends Instrumenter.Default
static final String TASK_CLASS_NAME = "akka.dispatch.forkjoin.ForkJoinTask";
public AkkaForkJoinTaskInstrumentation() {
- super(AbstractExecutorInstrumentation.EXEC_NAME + ".akka_fork_join");
+ super("akka_context_propagation");
}
@Override

MODIFY
instrumentation/akka-context-propagation-2.5/src/test/groovy/AkkaExecutorInstrumentationTest.groovy
instrumentation/akka-context-propagation-2.5/src/test/groovy/AkkaExecutorInstrumentationTest.groovy
@@ -36,7 +36,7 @@ import spock.lang.Shared
class AkkaExecutorInstrumentationTest extends AgentTestRunner {
static {
- System.setProperty("otel.integration.java_concurrent.akka_fork_join.enabled", "true")
+ System.setProperty("otel.integration.akka_context_propagation.enabled", "true")
}
@Shared

MODIFY
instrumentation/spark-web-framework-2.3/spark-web-framework-2.3.gradle
instrumentation/spark-web-framework-2.3/spark-web-framework-2.3.gradle
@@ -15,16 +15,6 @@ muzzle {
}
}
-compileTestJava {
- sourceCompatibility = "1.8"
- targetCompatibility = "1.8"
-}
-
-compileJava {
- sourceCompatibility = "1.7"
- targetCompatibility = "1.7"
-}
-
dependencies {
library group: 'com.sparkjava', name: 'spark-core', version: '2.3'

Separate out Akka ForkJoinPool instrumentation from java_concurrent (DataDog/dd-trace-java#1685)