Missing autoservice annotation processor

This commit is contained in:
Tyler Benson 2018-05-04 15:38:41 +10:00
parent 114f088766
commit 7dfdc2d50e
3 changed files with 13 additions and 1 deletions

View File

@ -28,6 +28,8 @@ dependencies {
compile deps.bytebuddy compile deps.bytebuddy
compile deps.opentracing compile deps.opentracing
compile deps.autoservice compile deps.autoservice
annotationProcessor deps.autoservice
implementation deps.autoservice
testCompile project(':dd-java-agent:testing') testCompile project(':dd-java-agent:testing')
testCompile project(':dd-java-agent:instrumentation:java-concurrent') testCompile project(':dd-java-agent:instrumentation:java-concurrent')

View File

@ -35,6 +35,8 @@ class HystrixTest extends AgentTestRunner {
operation(command) operation(command)
} }
expect: expect:
TRANSFORMED_CLASSES.contains("com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler\$ThreadPoolWorker")
TRANSFORMED_CLASSES.contains("HystrixTest\$1")
result == "Hello!" result == "Hello!"
assertTraces(TEST_WRITER, 1) { assertTraces(TEST_WRITER, 1) {
@ -106,6 +108,8 @@ class HystrixTest extends AgentTestRunner {
operation(command) operation(command)
} }
expect: expect:
TRANSFORMED_CLASSES.contains("com.netflix.hystrix.strategy.concurrency.HystrixContextScheduler\$ThreadPoolWorker")
TRANSFORMED_CLASSES.contains("HystrixTest\$2")
result == "Fallback!" result == "Fallback!"
assertTraces(TEST_WRITER, 1) { assertTraces(TEST_WRITER, 1) {

View File

@ -2,6 +2,7 @@ package datadog.trace.agent.test;
import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.Logger;
import com.google.common.collect.Sets;
import datadog.opentracing.DDSpan; import datadog.opentracing.DDSpan;
import datadog.opentracing.DDTracer; import datadog.opentracing.DDTracer;
import datadog.trace.agent.tooling.AgentInstaller; import datadog.trace.agent.tooling.AgentInstaller;
@ -13,6 +14,7 @@ import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.Instrumentation; import java.lang.instrument.Instrumentation;
import java.util.List; import java.util.List;
import java.util.ServiceLoader; import java.util.ServiceLoader;
import java.util.Set;
import java.util.concurrent.Phaser; import java.util.concurrent.Phaser;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import net.bytebuddy.agent.ByteBuddyAgent; import net.bytebuddy.agent.ByteBuddyAgent;
@ -58,6 +60,8 @@ public abstract class AgentTestRunner extends Specification {
// loads opentracing before bootstrap classpath is setup // loads opentracing before bootstrap classpath is setup
// so we declare tracer as an object and cast when needed. // so we declare tracer as an object and cast when needed.
protected static final Object TEST_TRACER; protected static final Object TEST_TRACER;
protected static final Set<String> TRANSFORMED_CLASSES = Sets.newConcurrentHashSet();
private static final AtomicInteger INSTRUMENTATION_ERROR_COUNT = new AtomicInteger(); private static final AtomicInteger INSTRUMENTATION_ERROR_COUNT = new AtomicInteger();
private static final Instrumentation instrumentation; private static final Instrumentation instrumentation;
@ -144,7 +148,9 @@ public abstract class AgentTestRunner extends Specification {
final ClassLoader classLoader, final ClassLoader classLoader,
final JavaModule module, final JavaModule module,
final boolean loaded, final boolean loaded,
final DynamicType dynamicType) {} final DynamicType dynamicType) {
TRANSFORMED_CLASSES.add(typeDescription.getActualName());
}
@Override @Override
public void onIgnored( public void onIgnored(