Skip to content

Commit

Permalink
Rename java packages for lettuce 4 and 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Devins-Suresh committed May 12, 2020
1 parent c20caa9 commit 663992d
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce4;

import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce4;

import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce4;

import static com.lambdaworks.redis.protocol.CommandKeyword.SEGFAULT;
import static com.lambdaworks.redis.protocol.CommandType.CLIENT;
Expand All @@ -10,7 +10,7 @@
import static com.lambdaworks.redis.protocol.CommandType.SHUTDOWN;
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.lettuce.LettuceClientDecorator.DECORATE;
import static datadog.trace.instrumentation.lettuce4.LettuceClientDecorator.DECORATE;

import com.lambdaworks.redis.RedisURI;
import com.lambdaworks.redis.protocol.AsyncCommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce4;

import com.lambdaworks.redis.protocol.AsyncCommand;
import com.lambdaworks.redis.protocol.RedisCommand;
Expand All @@ -20,5 +20,4 @@ public static void onExit(
@Advice.Return final AsyncCommand<?, ?, ?> asyncCommand) {
InstrumentationPoints.afterCommand(command, scope, throwable, asyncCommand);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce4;

import static datadog.trace.instrumentation.lettuce.InstrumentationPoints.getCommandResourceName;
import static datadog.trace.instrumentation.lettuce4.InstrumentationPoints.getCommandResourceName;

import com.lambdaworks.redis.RedisURI;
import com.lambdaworks.redis.protocol.RedisCommand;
Expand Down Expand Up @@ -40,17 +40,17 @@ protected String dbType() {
}

@Override
protected String dbUser(RedisURI connection) {
protected String dbUser(final RedisURI connection) {
return null;
}

@Override
protected String dbInstance(RedisURI connection) {
protected String dbInstance(final RedisURI connection) {
return null;
}

@Override
public AgentSpan onConnection(AgentSpan span, RedisURI connection) {
public AgentSpan onConnection(final AgentSpan span, final RedisURI connection) {
if (connection != null) {
span.setTag(Tags.PEER_HOSTNAME, connection.getHost());
span.setTag(Tags.PEER_PORT, connection.getPort());
Expand All @@ -60,18 +60,19 @@ public AgentSpan onConnection(AgentSpan span, RedisURI connection) {
return super.onConnection(span, connection);
}

public AgentSpan onCommand(AgentSpan span, RedisCommand<?, ?, ?> command) {
span.setTag(DDTags.RESOURCE_NAME,
public AgentSpan onCommand(final AgentSpan span, final RedisCommand<?, ?, ?> command) {
span.setTag(
DDTags.RESOURCE_NAME,
null == command ? "Redis Command" : getCommandResourceName(command.getType()));
return span;
}

private static String resourceName(RedisURI connection) {
private static String resourceName(final RedisURI connection) {
return "CONNECT:"
+ connection.getHost()
+ ":"
+ connection.getPort()
+ "/"
+ connection.getDatabase();
+ connection.getHost()
+ ":"
+ connection.getPort()
+ "/"
+ connection.getDatabase();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce4;

import com.lambdaworks.redis.RedisURI;
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
Expand All @@ -12,8 +12,8 @@ public static AgentScope onEnter(@Advice.Argument(1) final RedisURI redisURI) {
}

@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void onExit(@Advice.Enter final AgentScope scope,
@Advice.Thrown final Throwable throwable) {
public static void onExit(
@Advice.Enter final AgentScope scope, @Advice.Thrown final Throwable throwable) {
InstrumentationPoints.afterConnect(scope, throwable);
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import com.lambdaworks.redis.ClientOptions
import com.lambdaworks.redis.RedisClient
import com.lambdaworks.redis.RedisConnectionException
import com.lambdaworks.redis.RedisFuture
import com.lambdaworks.redis.RedisURI
import com.lambdaworks.redis.api.StatefulConnection
import com.lambdaworks.redis.api.async.RedisAsyncCommands
import com.lambdaworks.redis.api.sync.RedisCommands
import com.lambdaworks.redis.codec.Utf8StringCodec
import com.lambdaworks.redis.protocol.AsyncCommand
import datadog.trace.agent.test.AgentTestRunner
import datadog.trace.agent.test.utils.PortUtils
import datadog.trace.api.DDSpanTypes
import datadog.trace.bootstrap.instrumentation.api.Tags

import redis.embedded.RedisServer
import spock.lang.Shared
import spock.util.concurrent.AsyncConditions
import com.lambdaworks.redis.codec.Utf8StringCodec

import java.util.concurrent.CancellationException
import java.util.concurrent.TimeUnit
Expand All @@ -23,11 +23,9 @@ import java.util.function.BiFunction
import java.util.function.Consumer
import java.util.function.Function

import com.lambdaworks.redis.RedisConnectionException

import static datadog.trace.instrumentation.lettuce.InstrumentationPoints.AGENT_CRASHING_COMMAND_PREFIX
import static datadog.trace.instrumentation.lettuce4.InstrumentationPoints.AGENT_CRASHING_COMMAND_PREFIX

class LettuceAsyncClientTest extends AgentTestRunner {
class Lettuce4AsyncClientTest extends AgentTestRunner {
public static final String HOST = "127.0.0.1"
public static final int DB_INDEX = 0
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
Expand Down Expand Up @@ -107,7 +105,7 @@ class LettuceAsyncClientTest extends AgentTestRunner {

when:
StatefulConnection connection = testConnectionClient.connect(new Utf8StringCodec(),
new RedisURI(HOST, port, 3, TimeUnit.SECONDS))
new RedisURI(HOST, port, 3, TimeUnit.SECONDS))

then:
connection != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import datadog.trace.bootstrap.instrumentation.api.Tags
import redis.embedded.RedisServer
import spock.lang.Shared

import static datadog.trace.instrumentation.lettuce.InstrumentationPoints.AGENT_CRASHING_COMMAND_PREFIX
import static datadog.trace.instrumentation.lettuce4.InstrumentationPoints.AGENT_CRASHING_COMMAND_PREFIX

class LettuceSyncClientTest extends AgentTestRunner {
class Lettuce4SyncClientTest extends AgentTestRunner {
public static final String HOST = "127.0.0.1"
public static final int DB_INDEX = 0
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce5;

import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce5;

import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce5;

import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce5;

import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.lettuce.LettuceClientDecorator.DECORATE;
import static datadog.trace.instrumentation.lettuce5.LettuceClientDecorator.DECORATE;

import datadog.trace.bootstrap.instrumentation.api.AgentScope;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce5;

import static datadog.trace.instrumentation.lettuce.LettuceClientDecorator.DECORATE;
import static datadog.trace.instrumentation.lettuce5.LettuceClientDecorator.DECORATE;

import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import java.util.concurrent.CancellationException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce5;

import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activateSpan;
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.lettuce.LettuceClientDecorator.DECORATE;
import static datadog.trace.instrumentation.lettuce.LettuceInstrumentationUtil.expectsResponse;
import static datadog.trace.instrumentation.lettuce5.LettuceClientDecorator.DECORATE;
import static datadog.trace.instrumentation.lettuce5.LettuceInstrumentationUtil.expectsResponse;

import datadog.trace.bootstrap.instrumentation.api.AgentScope;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce5;

import datadog.trace.api.DDSpanTypes;
import datadog.trace.api.DDTags;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package datadog.trace.instrumentation.lettuce;
package datadog.trace.instrumentation.lettuce5;

import io.lettuce.core.protocol.RedisCommand;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package datadog.trace.instrumentation.lettuce.rx;
package datadog.trace.instrumentation.lettuce5.rx;

import static datadog.trace.instrumentation.lettuce.LettuceInstrumentationUtil.expectsResponse;
import static datadog.trace.instrumentation.lettuce5.LettuceInstrumentationUtil.expectsResponse;

import io.lettuce.core.protocol.RedisCommand;
import java.util.function.Supplier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package datadog.trace.instrumentation.lettuce.rx;
package datadog.trace.instrumentation.lettuce5.rx;

import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.lettuce.LettuceClientDecorator.DECORATE;
import static datadog.trace.instrumentation.lettuce5.LettuceClientDecorator.DECORATE;

import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import io.lettuce.core.protocol.RedisCommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package datadog.trace.instrumentation.lettuce.rx;
package datadog.trace.instrumentation.lettuce5.rx;

import static datadog.trace.instrumentation.lettuce.LettuceInstrumentationUtil.expectsResponse;
import static datadog.trace.instrumentation.lettuce5.LettuceInstrumentationUtil.expectsResponse;

import io.lettuce.core.protocol.RedisCommand;
import java.util.function.Supplier;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package datadog.trace.instrumentation.lettuce.rx;
package datadog.trace.instrumentation.lettuce5.rx;

import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.startSpan;
import static datadog.trace.instrumentation.lettuce.LettuceClientDecorator.DECORATE;
import static datadog.trace.instrumentation.lettuce5.LettuceClientDecorator.DECORATE;

import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import io.lettuce.core.protocol.RedisCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import java.util.function.BiFunction
import java.util.function.Consumer
import java.util.function.Function

import static datadog.trace.instrumentation.lettuce.LettuceInstrumentationUtil.AGENT_CRASHING_COMMAND_PREFIX
import static datadog.trace.instrumentation.lettuce5.LettuceInstrumentationUtil.AGENT_CRASHING_COMMAND_PREFIX

class LettuceAsyncClientTest extends AgentTestRunner {
class Lettuce5AsyncClientTest extends AgentTestRunner {
public static final String HOST = "127.0.0.1"
public static final int DB_INDEX = 0
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import spock.util.concurrent.AsyncConditions
import java.util.function.Consumer

import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
import static datadog.trace.instrumentation.lettuce.LettuceInstrumentationUtil.AGENT_CRASHING_COMMAND_PREFIX
import static datadog.trace.instrumentation.lettuce5.LettuceInstrumentationUtil.AGENT_CRASHING_COMMAND_PREFIX

class LettuceReactiveClientTest extends AgentTestRunner {
class Lettuce5ReactiveClientTest extends AgentTestRunner {
public static final String HOST = "127.0.0.1"
public static final int DB_INDEX = 0
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import spock.lang.Shared

import java.util.concurrent.CompletionException

import static datadog.trace.instrumentation.lettuce.LettuceInstrumentationUtil.AGENT_CRASHING_COMMAND_PREFIX
import static datadog.trace.instrumentation.lettuce5.LettuceInstrumentationUtil.AGENT_CRASHING_COMMAND_PREFIX

class LettuceSyncClientTest extends AgentTestRunner {
class Lettuce5SyncClientTest extends AgentTestRunner {
public static final String HOST = "127.0.0.1"
public static final int DB_INDEX = 0
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
Expand Down

0 comments on commit 663992d

Please sign in to comment.