add version to rediscala instrumentation name, update referenced dd class names, use random port for test
RENAME
dd-java-agent/instrumentation/rediscala/rediscala.gradle
dd-java-agent/instrumentation/rediscala-1.8.1/rediscala-1.8.1.gradle
RENAME
dd-java-agent/instrumentation/rediscala/src/main/java/datadog/trace/instrumentation/rediscala/RediscalaClientDecorator.java
dd-java-agent/instrumentation/rediscala-1.8.1/src/main/java/datadog/trace/instrumentation/rediscala/RediscalaClientDecorator.java
package datadog.trace.instrumentation.rediscala;
-import datadog.trace.agent.decorator.DatabaseClientDecorator;
import datadog.trace.api.DDSpanTypes;
+import datadog.trace.bootstrap.instrumentation.decorator.DatabaseClientDecorator;
import redis.RedisCommand;
+import redis.protocol.RedisReply;
+
+public class RediscalaClientDecorator
+ extends DatabaseClientDecorator<RedisCommand<? extends RedisReply, ?>> {
+
+ private static final String SERVICE_NAME = "redis";
+ private static final String COMPONENT_NAME = SERVICE_NAME + "-command";
-public class RediscalaClientDecorator extends DatabaseClientDecorator<RedisCommand> {
public static final RediscalaClientDecorator DECORATE = new RediscalaClientDecorator();
@Override
@@ -14,12 +20,12 @@ public class RediscalaClientDecorator extends DatabaseClientDecorator<RedisComma
@Override
protected String service() {
- return "redis";
+ return SERVICE_NAME;
}
@Override
protected String component() {
- return "redis-command";
+ return COMPONENT_NAME;
}
@Override
@@ -33,12 +39,12 @@ public class RediscalaClientDecorator extends DatabaseClientDecorator<RedisComma
}
@Override
- protected String dbUser(final RedisCommand session) {
+ protected String dbUser(final RedisCommand<? extends RedisReply, ?> session) {
return null;
}
@Override
- protected String dbInstance(final RedisCommand session) {
+ protected String dbInstance(final RedisCommand<? extends RedisReply, ?> session) {
return null;
}
}

RENAME
dd-java-agent/instrumentation/rediscala/src/main/java/datadog/trace/instrumentation/rediscala/RediscalaInstrumentation.java
dd-java-agent/instrumentation/rediscala-1.8.1/src/main/java/datadog/trace/instrumentation/rediscala/RediscalaInstrumentation.java
package datadog.trace.instrumentation.rediscala;
-import static datadog.trace.agent.tooling.ByteBuddyElementMatchers.safeHasSuperType;
-import static datadog.trace.instrumentation.api.AgentTracer.activateSpan;
-import static datadog.trace.instrumentation.api.AgentTracer.activeScope;
-import static datadog.trace.instrumentation.api.AgentTracer.startSpan;
+import static datadog.trace.agent.tooling.bytebuddy.matcher.DDElementMatchers.safeHasSuperType;
+import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
+import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeScope;
+import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.rediscala.RediscalaClientDecorator.DECORATE;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
@@ -14,9 +14,9 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
+import datadog.trace.bootstrap.instrumentation.api.AgentScope;
+import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import datadog.trace.context.TraceScope;
-import datadog.trace.instrumentation.api.AgentScope;
-import datadog.trace.instrumentation.api.AgentSpan;
import java.util.Map;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.method.MethodDescription;
@@ -31,9 +31,6 @@ import scala.util.Try;
@AutoService(Instrumenter.class)
public final class RediscalaInstrumentation extends Instrumenter.Default {
- private static final String SERVICE_NAME = "redis";
- private static final String COMPONENT_NAME = SERVICE_NAME + "-command";
-
public RediscalaInstrumentation() {
super("rediscala", "redis");
}
@@ -50,9 +47,9 @@ public final class RediscalaInstrumentation extends Instrumenter.Default {
public String[] helperClassNames() {
return new String[] {
RediscalaInstrumentation.class.getName() + "$OnCompleteHandler",
- "datadog.trace.agent.decorator.BaseDecorator",
- "datadog.trace.agent.decorator.ClientDecorator",
- "datadog.trace.agent.decorator.DatabaseClientDecorator",
+ "datadog.trace.bootstrap.instrumentation.decorator.BaseDecorator",
+ "datadog.trace.bootstrap.instrumentation.decorator.ClientDecorator",
+ "datadog.trace.bootstrap.instrumentation.decorator.DatabaseClientDecorator",
packageName + ".RediscalaClientDecorator",
};
}

RENAME
dd-java-agent/instrumentation/rediscala/src/test/groovy/RediscalaClientTest.groovy
dd-java-agent/instrumentation/rediscala-1.8.1/src/test/groovy/RediscalaClientTest.groovy
import akka.actor.ActorSystem
import datadog.trace.agent.test.AgentTestRunner
+import datadog.trace.agent.test.utils.PortUtils
import datadog.trace.api.Config
import datadog.trace.api.DDSpanTypes
-import datadog.trace.instrumentation.api.Tags
+import datadog.trace.bootstrap.instrumentation.api.Tags
import redis.ByteStringSerializerLowPriority
import redis.ByteStringDeserializerDefault
import redis.RedisClient
@@ -15,7 +16,8 @@ import spock.lang.Shared
class RediscalaClientTest extends AgentTestRunner {
- public static final int PORT = 6399
+ @Shared
+ int port = PortUtils.randomOpenPort()
@Shared
RedisServer redisServer = RedisServer.builder()
@@ -23,7 +25,7 @@ class RediscalaClientTest extends AgentTestRunner {
.setting("bind 127.0.0.1")
// set max memory to avoid problems in CI
.setting("maxmemory 128M")
- .port(PORT).build()
+ .port(port).build()
@Shared
ActorSystem system
@@ -34,7 +36,7 @@ class RediscalaClientTest extends AgentTestRunner {
def setupSpec() {
system = ActorSystem.create()
redisClient = new RedisClient("localhost",
- PORT,
+ port,
Option.apply(null),
Option.apply(null),
"RedisClient",
@@ -81,8 +83,8 @@ class RediscalaClientTest extends AgentTestRunner {
spanType DDSpanTypes.REDIS
tags {
"$Tags.COMPONENT" "redis-command"
- "$Tags.DB_TYPE" "redis"
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
+ "$Tags.DB_TYPE" "redis"
defaultTags()
}
}
@@ -113,8 +115,8 @@ class RediscalaClientTest extends AgentTestRunner {
spanType DDSpanTypes.REDIS
tags {
"$Tags.COMPONENT" "redis-command"
- "$Tags.DB_TYPE" "redis"
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
+ "$Tags.DB_TYPE" "redis"
defaultTags()
}
}
@@ -127,8 +129,8 @@ class RediscalaClientTest extends AgentTestRunner {
spanType DDSpanTypes.REDIS
tags {
"$Tags.COMPONENT" "redis-command"
- "$Tags.DB_TYPE" "redis"
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
+ "$Tags.DB_TYPE" "redis"
defaultTags()
}
}

MODIFY
settings.gradle
settings.gradle
@@ -126,7 +126,7 @@ include ':dd-java-agent:instrumentation:play-ws-2'
include ':dd-java-agent:instrumentation:play-ws-2.1'
include ':dd-java-agent:instrumentation:rabbitmq-amqp-2.7'
include ':dd-java-agent:instrumentation:ratpack-1.4'
-include ':dd-java-agent:instrumentation:rediscala'
+include ':dd-java-agent:instrumentation:rediscala-1.8.1'
include ':dd-java-agent:instrumentation:reactor-core-3.1'
include ':dd-java-agent:instrumentation:rmi'
include ':dd-java-agent:instrumentation:rxjava-1'

add version to rediscala instrumentation name, update referenced dd class names, use random port for test