Extract Akka context propagation into separate module
ADD
instrumentation/akka-context-propagation/akka-context-propagation.gradle
+apply from: "$rootDir/gradle/instrumentation.gradle"
+apply from: "$rootDir/gradle/test-with-scala.gradle"
+
+dependencies {
+ implementation project(':instrumentation:java-concurrent')
+ compileOnly group: 'com.typesafe.akka', name: 'akka-actor_2.11', version: '2.5.0'
+
+ testImplementation deps.scala
+ testImplementation group: 'com.typesafe.akka', name: 'akka-actor_2.11', version: '2.5.0'
+}
\ No newline at end of file

RENAME
instrumentation/java-concurrent/src/main/java/io/opentelemetry/auto/instrumentation/javaconcurrent/AkkaExecutorInstrumentation.java
instrumentation/akka-context-propagation/src/main/java/io/opentelemetry/auto/instrumentation/akkaconcurrent/AkkaExecutorInstrumentation.java
* limitations under the License.
*/
-package io.opentelemetry.auto.instrumentation.javaconcurrent;
+package io.opentelemetry.auto.instrumentation.akkaconcurrent;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.nameMatches;
@@ -28,6 +28,7 @@ import io.opentelemetry.auto.bootstrap.ContextStore;
import io.opentelemetry.auto.bootstrap.InstrumentationContext;
import io.opentelemetry.auto.bootstrap.instrumentation.java.concurrent.ExecutorInstrumentationUtils;
import io.opentelemetry.auto.bootstrap.instrumentation.java.concurrent.State;
+import io.opentelemetry.auto.instrumentation.javaconcurrent.AbstractExecutorInstrumentation;
import io.opentelemetry.auto.tooling.Instrumenter;
import java.util.HashMap;
import java.util.Map;
@@ -40,7 +41,12 @@ import net.bytebuddy.matcher.ElementMatcher;
public final class AkkaExecutorInstrumentation extends AbstractExecutorInstrumentation {
public AkkaExecutorInstrumentation() {
- super(EXEC_NAME + ".akka_fork_join");
+ super(AbstractExecutorInstrumentation.EXEC_NAME + ".akka_fork_join");
+ }
+
+ @Override
+ protected boolean defaultEnabled() {
+ return false;
}
@Override

RENAME
instrumentation/java-concurrent/src/main/java/io/opentelemetry/auto/instrumentation/javaconcurrent/AkkaForkJoinTaskInstrumentation.java
instrumentation/akka-context-propagation/src/main/java/io/opentelemetry/auto/instrumentation/akkaconcurrent/AkkaForkJoinTaskInstrumentation.java
* limitations under the License.
*/
-package io.opentelemetry.auto.instrumentation.javaconcurrent;
+package io.opentelemetry.auto.instrumentation.akkaconcurrent;
import static io.opentelemetry.auto.tooling.ClassLoaderMatcher.hasClassesNamed;
import static io.opentelemetry.auto.tooling.bytebuddy.matcher.AgentElementMatchers.extendsClass;
@@ -31,6 +31,7 @@ import io.opentelemetry.auto.bootstrap.ContextStore;
import io.opentelemetry.auto.bootstrap.InstrumentationContext;
import io.opentelemetry.auto.bootstrap.instrumentation.java.concurrent.AdviceUtils;
import io.opentelemetry.auto.bootstrap.instrumentation.java.concurrent.State;
+import io.opentelemetry.auto.instrumentation.javaconcurrent.AbstractExecutorInstrumentation;
import io.opentelemetry.auto.tooling.Instrumenter;
import io.opentelemetry.context.Scope;
import java.util.Collections;
@@ -54,7 +55,12 @@ public final class AkkaForkJoinTaskInstrumentation extends Instrumenter.Default
static final String TASK_CLASS_NAME = "akka.dispatch.forkjoin.ForkJoinTask";
public AkkaForkJoinTaskInstrumentation() {
- super(AbstractExecutorInstrumentation.EXEC_NAME);
+ super(AbstractExecutorInstrumentation.EXEC_NAME + ".akka_fork_join");
+ }
+
+ @Override
+ protected boolean defaultEnabled() {
+ return false;
}
@Override

RENAME
instrumentation/java-concurrent/akka-testing/src/test/groovy/AkkaActorTest.groovy
instrumentation/akka-context-propagation/src/test/groovy/AkkaActorTest.groovy
RENAME
instrumentation/java-concurrent/akka-2.5-testing/src/test/groovy/AkkaExecutorInstrumentationTest.groovy
instrumentation/akka-context-propagation/src/test/groovy/AkkaExecutorInstrumentationTest.groovy
@@ -18,8 +18,6 @@ import akka.dispatch.forkjoin.ForkJoinPool
import akka.dispatch.forkjoin.ForkJoinTask
import io.opentelemetry.auto.test.AgentTestRunner
import io.opentelemetry.sdk.trace.data.SpanData
-import spock.lang.Shared
-
import java.lang.reflect.InvocationTargetException
import java.util.concurrent.ArrayBlockingQueue
import java.util.concurrent.Callable
@@ -27,6 +25,7 @@ import java.util.concurrent.Future
import java.util.concurrent.RejectedExecutionException
import java.util.concurrent.ThreadPoolExecutor
import java.util.concurrent.TimeUnit
+import spock.lang.Shared
import static io.opentelemetry.auto.test.utils.TraceUtils.runUnderTrace
@@ -36,6 +35,10 @@ import static io.opentelemetry.auto.test.utils.TraceUtils.runUnderTrace
*/
class AkkaExecutorInstrumentationTest extends AgentTestRunner {
+ static {
+ System.setProperty("otel.integration.java_concurrent.akka_fork_join.enabled", "true")
+ }
+
@Shared
def executeRunnable = { e, c -> e.execute((Runnable) c) }
@Shared
@@ -127,7 +130,7 @@ class AkkaExecutorInstrumentationTest extends AgentTestRunner {
throw e.getCause()
}
}
- } catch (RejectedExecutionException e) {
+ } catch (RejectedExecutionException ignored) {
}
for (Future f : jobFutures) {

RENAME
instrumentation/java-concurrent/akka-testing/src/test/scala/AkkaActors.scala
instrumentation/akka-context-propagation/src/test/scala/AkkaActors.scala
RENAME
instrumentation/java-concurrent/akka-2.5-testing/src/test/scala/AkkaAsyncChild.java
instrumentation/akka-context-propagation/src/test/scala/AkkaAsyncChild.java
DELETE
instrumentation/java-concurrent/akka-2.5-testing/akka-2.5-testing.gradle
-// Set properties before any plugins get loaded
-ext {
- minJavaVersionForTests = JavaVersion.VERSION_1_8
- skipPublish = true
- retryTests = true
-}
-
-apply from: "$rootDir/gradle/instrumentation.gradle"
-apply from: "$rootDir/gradle/test-with-scala.gradle"
-
-dependencies {
- compileOnly deps.scala
-
- testImplementation deps.scala
- testImplementation group: 'com.typesafe.akka', name: 'akka-actor_2.11', version: '2.5.0'
-
- testImplementation project(':instrumentation:java-concurrent')
- testImplementation project(':instrumentation:annotations')
-}

DELETE
instrumentation/java-concurrent/akka-testing/akka-testing.gradle
-ext {
- skipPublish = true
- retryTests = true
-}
-apply from: "$rootDir/gradle/instrumentation.gradle"
-apply from: "$rootDir/gradle/test-with-scala.gradle"
-
-dependencies {
- compileOnly deps.scala
-
- testImplementation deps.scala
- testImplementation group: 'com.typesafe.akka', name: 'akka-actor_2.11', version: '2.3.16'
- testImplementation group: 'com.typesafe.akka', name: 'akka-testkit_2.11', version: '2.3.16'
-
- testImplementation project(':instrumentation:java-concurrent')
- testImplementation project(':instrumentation:annotations')
-}

MODIFY
instrumentation/java-concurrent/java-concurrent.gradle
instrumentation/java-concurrent/java-concurrent.gradle
@@ -20,8 +20,6 @@ compileSlickTestGroovy {
dependencies {
// This is needed for Scala ForJoinTask/Pool instrumentation
compileOnly deps.scala
- // This is needed for Akka ForJoinTask/Pool instrumentation
- compileOnly group: 'com.typesafe.akka', name: 'akka-actor_2.11', version: '2.5.0'
testImplementation project(':instrumentation:annotations')
@@ -35,12 +33,3 @@ dependencies {
// Run Slick library tests along with the rest of unit tests
test.dependsOn slickTest
\ No newline at end of file
-
-// Until custom source sets can use minJavaVersionForTests separately from other tests
-// force this one test to run on java8 only
-slickTest {
- onlyIf {
- String java8Home = findJavaHome(JavaVersion.VERSION_1_8)
- java8Home != null && executable == toExecutable(java8Home)
- }
-}

MODIFY
settings.gradle
settings.gradle
@@ -40,6 +40,7 @@ include ':smoke-tests:wildfly'
include ':smoke-tests:springboot'
// instrumentation:
+include ':instrumentation:akka-context-propagation'
include ':instrumentation:akka-http-10.0'
include ':instrumentation:annotations'
include ':instrumentation:apache-httpasyncclient-4.0'
@@ -84,11 +85,8 @@ include ':instrumentation:java-classloader:jboss-testing'
include ':instrumentation:java-classloader:osgi-testing'
include ':instrumentation:java-classloader:tomcat-testing'
include ':instrumentation:java-concurrent'
-include ':instrumentation:java-concurrent:java-completablefuture'
include ':instrumentation:java-concurrent:kotlin-testing'
include ':instrumentation:java-concurrent:scala-testing'
-include ':instrumentation:java-concurrent:akka-testing'
-include ':instrumentation:java-concurrent:akka-2.5-testing'
include ':instrumentation:jaxrs:jaxrs-1.0'
include ':instrumentation:jaxrs:jaxrs-2.0'
include ':instrumentation:jaxrs:jaxrs-2.0:jaxrs-2.0-jersey-2.0'

Extract Akka context propagation into separate module (#911)