Misc cleanup/minor changes
MODIFY
dd-java-agent/instrumentation/aws-sdk/src/main/java/datadog/trace/instrumentation/aws/AWSClientInstrumentation.java
dd-java-agent/instrumentation/aws-sdk/src/main/java/datadog/trace/instrumentation/aws/AWSClientInstrumentation.java
@@ -48,6 +48,7 @@ public final class AWSClientInstrumentation extends Instrumenter.Configurable {
}
public static class AWSClientAdvice {
+ // Since we're instrumenting the constructor, we can't add onThrowable.
@Advice.OnMethodExit(suppress = Throwable.class)
public static void addHandler(
@Advice.FieldValue("requestHandler2s") final List<RequestHandler2> handlers) {

MODIFY
dd-java-agent/instrumentation/java-concurrent/src/main/java/datadog/trace/instrumentation/java/concurrent/FutureInstrumentation.java
dd-java-agent/instrumentation/java-concurrent/src/main/java/datadog/trace/instrumentation/java/concurrent/FutureInstrumentation.java
@@ -61,8 +61,7 @@ public final class FutureInstrumentation extends Instrumenter.Configurable {
"com.google.common.util.concurrent.AbstractFuture$TrustedFuture",
"com.google.common.util.concurrent.AbstractFuture"
};
- WHITELISTED_FUTURES =
- Collections.unmodifiableSet(new HashSet<String>(Arrays.asList(whitelist)));
+ WHITELISTED_FUTURES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(whitelist)));
}
public FutureInstrumentation() {
@@ -81,7 +80,7 @@ public final class FutureInstrumentation extends Instrumenter.Configurable {
.and(
new ElementMatcher<TypeDescription>() {
@Override
- public boolean matches(TypeDescription target) {
+ public boolean matches(final TypeDescription target) {
final boolean whitelisted = WHITELISTED_FUTURES.contains(target.getName());
if (!whitelisted) {
log.debug("Skipping future instrumentation for {}", target.getName());
@@ -101,13 +100,13 @@ public final class FutureInstrumentation extends Instrumenter.Configurable {
public static class CanceledFutureAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
- public static DatadogWrapper findWrapper(@Advice.This Future<?> future) {
+ public static DatadogWrapper findWrapper(@Advice.This final Future<?> future) {
return ConcurrentUtils.getDatadogWrapper(future);
}
@Advice.OnMethodExit(suppress = Throwable.class)
public static void abortTracing(
- @Advice.Enter final DatadogWrapper wrapper, @Advice.Return boolean canceled) {
+ @Advice.Enter final DatadogWrapper wrapper, @Advice.Return final boolean canceled) {
if (canceled && null != wrapper) {
wrapper.cancel();
}

MODIFY
dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/ConnectionInstrumentation.java
dd-java-agent/instrumentation/jdbc/src/main/java/datadog/trace/instrumentation/jdbc/ConnectionInstrumentation.java
@@ -61,6 +61,7 @@ public final class ConnectionInstrumentation extends Instrumenter.Configurable {
return CallDepthThreadLocalMap.get(Connection.class).incrementCallDepth();
}
+ // Since we're instrumenting the constructor, we can't add onThrowable.
@Advice.OnMethodExit(suppress = Throwable.class)
public static void constructorExit(
@Advice.Enter final int depth, @Advice.This final Connection connection)

MODIFY
dd-java-agent/instrumentation/kafka-clients-0.11/src/main/java/datadog/trace/instrumentation/kafka_clients/KafkaConsumerInstrumentation.java
dd-java-agent/instrumentation/kafka-clients-0.11/src/main/java/datadog/trace/instrumentation/kafka_clients/KafkaConsumerInstrumentation.java
@@ -71,19 +71,23 @@ public final class KafkaConsumerInstrumentation extends Instrumenter.Configurabl
@Advice.OnMethodExit(suppress = Throwable.class)
public static void wrap(@Advice.Return(readOnly = false) Iterable<ConsumerRecord> iterable) {
+ if (iterable != null) {
iterable = new TracingIterable(iterable, "kafka.consume", ConsumeScopeAction.INSTANCE);
}
}
+ }
public static class IteratorAdvice {
@Advice.OnMethodExit(suppress = Throwable.class)
public static void wrap(@Advice.Return(readOnly = false) Iterator<ConsumerRecord> iterator) {
+ if (iterator != null) {
iterator =
new TracingIterable.TracingIterator(
iterator, "kafka.consume", ConsumeScopeAction.INSTANCE);
}
}
+ }
public static class ConsumeScopeAction
implements TracingIterable.SpanBuilderDecorator<ConsumerRecord> {

MODIFY
dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsProcessorInstrumentation.java
dd-java-agent/instrumentation/kafka-streams-0.11/src/main/java/datadog/trace/instrumentation/kafka_streams/KafkaStreamsProcessorInstrumentation.java
@@ -112,11 +112,11 @@ public class KafkaStreamsProcessorInstrumentation {
DDAdvice.create()
.advice(
isMethod().and(isPublic()).and(named("process")).and(takesArguments(0)),
- StartSpanAdvice.class.getName()))
+ StopSpanAdvice.class.getName()))
.asDecorator();
}
- public static class StartSpanAdvice {
+ public static class StopSpanAdvice {
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void stopSpan(@Advice.Thrown final Throwable throwable) {

MODIFY
dd-java-agent/instrumentation/sparkjava-2.4/src/main/java/datadog/trace/instrumentation/sparkjava/RoutesInstrumentation.java
dd-java-agent/instrumentation/sparkjava-2.4/src/main/java/datadog/trace/instrumentation/sparkjava/RoutesInstrumentation.java
@@ -45,7 +45,7 @@ public class RoutesInstrumentation extends Instrumenter.Configurable {
public static class RoutesAdvice {
- @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
+ @Advice.OnMethodExit(suppress = Throwable.class)
public static void routeMatchEnricher(
@Advice.Argument(0) final HttpMethod method, @Advice.Return final RouteMatch routeMatch) {

MODIFY
dd-java-agent/testing/src/test/java/IBMResourceLevelInstrumentation.java
dd-java-agent/testing/src/test/java/IBMResourceLevelInstrumentation.java
@@ -14,7 +14,7 @@ public class IBMResourceLevelInstrumentation extends Instrumenter.Configurable {
}
@Override
- protected AgentBuilder apply(AgentBuilder agentBuilder) {
+ protected AgentBuilder apply(final AgentBuilder agentBuilder) {
return agentBuilder
.type(named("com.ibm.as400.resource.ResourceLevel"))
.transform(DDTransformers.defaultTransformers())

MODIFY
dd-trace-ot/src/main/java/datadog/trace/common/writer/ListWriter.java
dd-trace-ot/src/main/java/datadog/trace/common/writer/ListWriter.java
@@ -38,7 +38,7 @@ public class ListWriter extends CopyOnWriteArrayList<List<DDSpan>> implements Wr
}
latches.add(latch);
}
- if (!latch.await(5, TimeUnit.SECONDS)) {
+ if (!latch.await(20, TimeUnit.SECONDS)) {
throw new TimeoutException("Timeout waiting for " + number + " trace(s).");
}
}

Misc cleanup/minor changes