Better span names for redis
MODIFY
instrumentation/jedis/jedis-1.4/src/main/java/io/opentelemetry/auto/instrumentation/jedis/JedisInstrumentation.java
instrumentation/jedis/jedis-1.4/src/main/java/io/opentelemetry/auto/instrumentation/jedis/JedisInstrumentation.java
@@ -77,7 +77,7 @@ public final class JedisInstrumentation extends Instrumenter.Default {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static SpanWithScope onEnter(@Advice.Argument(1) final Command command) {
- final Span span = TRACER.spanBuilder("redis.query").setSpanKind(CLIENT).startSpan();
+ final Span span = TRACER.spanBuilder(command.name()).setSpanKind(CLIENT).startSpan();
DECORATE.afterStart(span);
DECORATE.onStatement(span, command.name());
return new SpanWithScope(span, TRACER.withSpan(span));

MODIFY
instrumentation/jedis/jedis-1.4/src/test/groovy/JedisClientTest.groovy
instrumentation/jedis/jedis-1.4/src/test/groovy/JedisClientTest.groovy
@@ -68,7 +68,7 @@ class JedisClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SET"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"
@@ -93,7 +93,7 @@ class JedisClientTest extends AgentTestRunner {
assertTraces(2) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SET"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"
@@ -106,7 +106,7 @@ class JedisClientTest extends AgentTestRunner {
}
trace(1, 1) {
span(0) {
- operationName "redis.query"
+ operationName "GET"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"
@@ -131,7 +131,7 @@ class JedisClientTest extends AgentTestRunner {
assertTraces(2) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SET"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"
@@ -144,7 +144,7 @@ class JedisClientTest extends AgentTestRunner {
}
trace(1, 1) {
span(0) {
- operationName "redis.query"
+ operationName "RANDOMKEY"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"

MODIFY
instrumentation/jedis/jedis-3.0/src/main/java/io/opentelemetry/auto/instrumentation/jedis30/JedisInstrumentation.java
instrumentation/jedis/jedis-3.0/src/main/java/io/opentelemetry/auto/instrumentation/jedis30/JedisInstrumentation.java
@@ -71,15 +71,17 @@ public final class JedisInstrumentation extends Instrumenter.Default {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static SpanWithScope onEnter(@Advice.Argument(1) final ProtocolCommand command) {
- final Span span = TRACER.spanBuilder("redis.query").setSpanKind(CLIENT).startSpan();
- DECORATE.afterStart(span);
+ final String query;
if (command instanceof Protocol.Command) {
- DECORATE.onStatement(span, ((Protocol.Command) command).name());
+ query = ((Protocol.Command) command).name();
} else {
// Protocol.Command is the only implementation in the Jedis lib as of 3.1 but this will save
// us if that changes
- DECORATE.onStatement(span, new String(command.getRaw(), StandardCharsets.UTF_8));
+ query = new String(command.getRaw(), StandardCharsets.UTF_8);
}
+ final Span span = TRACER.spanBuilder(query).setSpanKind(CLIENT).startSpan();
+ DECORATE.afterStart(span);
+ DECORATE.onStatement(span, query);
return new SpanWithScope(span, TRACER.withSpan(span));
}

MODIFY
instrumentation/jedis/jedis-3.0/src/test/groovy/Jedis30ClientTest.groovy
instrumentation/jedis/jedis-3.0/src/test/groovy/Jedis30ClientTest.groovy
@@ -68,7 +68,7 @@ class Jedis30ClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SET"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"
@@ -93,7 +93,7 @@ class Jedis30ClientTest extends AgentTestRunner {
assertTraces(2) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SET"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"
@@ -106,7 +106,7 @@ class Jedis30ClientTest extends AgentTestRunner {
}
trace(1, 1) {
span(0) {
- operationName "redis.query"
+ operationName "GET"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"
@@ -131,7 +131,7 @@ class Jedis30ClientTest extends AgentTestRunner {
assertTraces(2) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SET"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"
@@ -144,7 +144,7 @@ class Jedis30ClientTest extends AgentTestRunner {
}
trace(1, 1) {
span(0) {
- operationName "redis.query"
+ operationName "RANDOMKEY"
spanKind CLIENT
tags {
"$MoreTags.SERVICE_NAME" "redis"

MODIFY
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/ConnectionFutureAdvice.java
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/ConnectionFutureAdvice.java
@@ -29,7 +29,7 @@ public class ConnectionFutureAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static SpanWithScope onEnter(@Advice.Argument(1) final RedisURI redisURI) {
- final Span span = TRACER.spanBuilder("redis.query").setSpanKind(CLIENT).startSpan();
+ final Span span = TRACER.spanBuilder("CONNECT").setSpanKind(CLIENT).startSpan();
DECORATE.afterStart(span);
DECORATE.onConnection(span, redisURI);
return new SpanWithScope(span, TRACER.withSpan(span));

MODIFY
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/LettuceAsyncCommandsAdvice.java
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/LettuceAsyncCommandsAdvice.java
@@ -31,9 +31,12 @@ public class LettuceAsyncCommandsAdvice {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static SpanWithScope onEnter(@Advice.Argument(0) final RedisCommand command) {
- final Span span = TRACER.spanBuilder("redis.query").setSpanKind(CLIENT).startSpan();
+ final Span span =
+ TRACER
+ .spanBuilder(LettuceInstrumentationUtil.getCommandName(command))
+ .setSpanKind(CLIENT)
+ .startSpan();
DECORATE.afterStart(span);
- DECORATE.onCommand(span, command);
return new SpanWithScope(span, TRACER.withSpan(span));
}

MODIFY
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/LettuceClientDecorator.java
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/LettuceClientDecorator.java
package io.opentelemetry.auto.instrumentation.lettuce;
import io.lettuce.core.RedisURI;
-import io.lettuce.core.protocol.RedisCommand;
import io.opentelemetry.OpenTelemetry;
import io.opentelemetry.auto.bootstrap.instrumentation.decorator.DatabaseClientDecorator;
import io.opentelemetry.auto.instrumentation.api.MoreTags;
@@ -67,22 +66,7 @@ public class LettuceClientDecorator extends DatabaseClientDecorator<RedisURI> {
span.setAttribute(MoreTags.NET_PEER_PORT, connection.getPort());
span.setAttribute("db.redis.dbIndex", connection.getDatabase());
- span.setAttribute(
- MoreTags.RESOURCE_NAME,
- "CONNECT:"
- + connection.getHost()
- + ":"
- + connection.getPort()
- + "/"
- + connection.getDatabase());
}
return super.onConnection(span, connection);
}
-
- public Span onCommand(final Span span, final RedisCommand command) {
- final String commandName = LettuceInstrumentationUtil.getCommandName(command);
- span.setAttribute(
- MoreTags.RESOURCE_NAME, LettuceInstrumentationUtil.getCommandResourceName(commandName));
- return span;
- }
}

MODIFY
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/LettuceInstrumentationUtil.java
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/LettuceInstrumentationUtil.java
@@ -25,17 +25,9 @@ public class LettuceInstrumentationUtil {
public static final String[] NON_INSTRUMENTING_COMMAND_WORDS =
new String[] {"SHUTDOWN", "DEBUG", "OOM", "SEGFAULT"};
- public static final String[] AGENT_CRASHING_COMMANDS_WORDS =
- new String[] {"CLIENT", "CLUSTER", "COMMAND", "CONFIG", "DEBUG", "SCRIPT"};
-
- public static final String AGENT_CRASHING_COMMAND_PREFIX = "COMMAND-NAME:";
-
public static final Set<String> nonInstrumentingCommands =
new HashSet<>(Arrays.asList(NON_INSTRUMENTING_COMMAND_WORDS));
- public static final Set<String> agentCrashingCommands =
- new HashSet<>(Arrays.asList(AGENT_CRASHING_COMMANDS_WORDS));
-
/**
* Determines whether a redis command should finish its relevant span early (as soon as tags are
* added and the command is executed) because these commands have no return values/call backs, so
@@ -49,30 +41,6 @@ public class LettuceInstrumentationUtil {
return nonInstrumentingCommands.contains(commandName);
}
- // Workaround to keep trace agent from crashing
- // Currently the commands in AGENT_CRASHING_COMMANDS_WORDS will crash the trace agent and
- // traces with these commands as the resource name will not be processed by the trace agent
- // https://github.com/DataDog/datadog-trace-agent/blob/master/quantizer/redis.go#L18 has
- // list of commands that will currently fail at the trace agent level.
-
- /**
- * Workaround to keep trace agent from crashing Currently the commands in
- * AGENT_CRASHING_COMMANDS_WORDS will crash the trace agent and traces with these commands as the
- * resource name will not be processed by the trace agent
- * https://github.com/DataDog/datadog-trace-agent/blob/master/quantizer/redis.go#L18 has list of
- * commands that will currently fail at the trace agent level.
- *
- * @param actualCommandName the actual redis command
- * @return the redis command with a prefix if it is a command that will crash the trace agent,
- * otherwise, the original command is returned.
- */
- public static String getCommandResourceName(final String actualCommandName) {
- if (agentCrashingCommands.contains(actualCommandName)) {
- return AGENT_CRASHING_COMMAND_PREFIX + actualCommandName;
- }
- return actualCommandName;
- }
-
/**
* Retrieves the actual redis command name from a RedisCommand object
*

MODIFY
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/rx/LettuceFluxTerminationRunnable.java
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/rx/LettuceFluxTerminationRunnable.java
@@ -20,6 +20,7 @@ import static io.opentelemetry.auto.instrumentation.lettuce.LettuceClientDecorat
import static io.opentelemetry.trace.Span.Kind.CLIENT;
import io.lettuce.core.protocol.RedisCommand;
+import io.opentelemetry.auto.instrumentation.lettuce.LettuceInstrumentationUtil;
import io.opentelemetry.trace.Span;
import java.util.function.Consumer;
import org.reactivestreams.Subscription;
@@ -99,10 +100,13 @@ public class LettuceFluxTerminationRunnable implements Consumer<Signal>, Runnabl
@Override
public void accept(final Subscription subscription) {
- final Span span = TRACER.spanBuilder("redis.query").setSpanKind(CLIENT).startSpan();
+ final Span span =
+ TRACER
+ .spanBuilder(LettuceInstrumentationUtil.getCommandName(command))
+ .setSpanKind(CLIENT)
+ .startSpan();
owner.span = span;
DECORATE.afterStart(span);
- DECORATE.onCommand(span, command);
if (finishSpanOnClose) {
DECORATE.beforeFinish(span);
span.end();

MODIFY
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/rx/LettuceMonoDualConsumer.java
instrumentation/lettuce-5.0/src/main/java8/io/opentelemetry/auto/instrumentation/lettuce/rx/LettuceMonoDualConsumer.java
@@ -20,6 +20,7 @@ import static io.opentelemetry.auto.instrumentation.lettuce.LettuceClientDecorat
import static io.opentelemetry.trace.Span.Kind.CLIENT;
import io.lettuce.core.protocol.RedisCommand;
+import io.opentelemetry.auto.instrumentation.lettuce.LettuceInstrumentationUtil;
import io.opentelemetry.trace.Span;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
@@ -40,9 +41,12 @@ public class LettuceMonoDualConsumer<R, T, U extends Throwable>
@Override
public void accept(final R r) {
- span = TRACER.spanBuilder("redis.query").setSpanKind(CLIENT).startSpan();
+ span =
+ TRACER
+ .spanBuilder(LettuceInstrumentationUtil.getCommandName(command))
+ .setSpanKind(CLIENT)
+ .startSpan();
DECORATE.afterStart(span);
- DECORATE.onCommand(span, command);
if (finishSpanOnClose) {
span.end();
}

MODIFY
instrumentation/lettuce-5.0/src/test/groovy/LettuceAsyncClientTest.groovy
instrumentation/lettuce-5.0/src/test/groovy/LettuceAsyncClientTest.groovy
@@ -41,7 +41,6 @@ import java.util.function.BiFunction
import java.util.function.Consumer
import java.util.function.Function
-import static io.opentelemetry.auto.instrumentation.lettuce.LettuceInstrumentationUtil.AGENT_CRASHING_COMMAND_PREFIX
import static io.opentelemetry.trace.Span.Kind.CLIENT
class LettuceAsyncClientTest extends AgentTestRunner {
@@ -132,12 +131,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "CONNECT"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "CONNECT:" + dbAddr
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$MoreTags.NET_PEER_NAME" HOST
@@ -169,12 +167,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "CONNECT"
spanKind CLIENT
errored true
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "CONNECT:" + dbAddrNonExistent
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$MoreTags.NET_PEER_NAME" HOST
@@ -198,12 +195,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "SET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -234,12 +230,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "GET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "GET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -284,12 +279,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "GET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "GET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -320,12 +314,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "RANDOMKEY"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "RANDOMKEY"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -374,12 +367,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(2) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "HMSET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "HMSET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -388,12 +380,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
}
trace(1, 1) {
span(0) {
- operationName "redis.query"
+ operationName "HGETALL"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "HGETALL"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -432,12 +423,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "DEL"
spanKind CLIENT
errored true
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "DEL"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -471,12 +461,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SADD"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "SADD"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -495,12 +484,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "DEBUG"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" AGENT_CRASHING_COMMAND_PREFIX + "DEBUG"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -519,12 +507,11 @@ class LettuceAsyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SHUTDOWN"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "SHUTDOWN"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"

MODIFY
instrumentation/lettuce-5.0/src/test/groovy/LettuceReactiveClientTest.groovy
instrumentation/lettuce-5.0/src/test/groovy/LettuceReactiveClientTest.groovy
@@ -29,7 +29,6 @@ import spock.util.concurrent.AsyncConditions
import java.util.function.Consumer
-import static io.opentelemetry.auto.instrumentation.lettuce.LettuceInstrumentationUtil.AGENT_CRASHING_COMMAND_PREFIX
import static io.opentelemetry.trace.Span.Kind.CLIENT
class LettuceReactiveClientTest extends AgentTestRunner {
@@ -105,12 +104,11 @@ class LettuceReactiveClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "SET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -132,12 +130,11 @@ class LettuceReactiveClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "GET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "GET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -167,12 +164,11 @@ class LettuceReactiveClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "GET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "GET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -200,12 +196,11 @@ class LettuceReactiveClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "RANDOMKEY"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "RANDOMKEY"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -223,12 +218,11 @@ class LettuceReactiveClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "COMMAND"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" AGENT_CRASHING_COMMAND_PREFIX + "COMMAND"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -247,12 +241,11 @@ class LettuceReactiveClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "COMMAND"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" AGENT_CRASHING_COMMAND_PREFIX + "COMMAND"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -284,12 +277,11 @@ class LettuceReactiveClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "DEBUG"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" AGENT_CRASHING_COMMAND_PREFIX + "DEBUG"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -307,12 +299,11 @@ class LettuceReactiveClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SHUTDOWN"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "SHUTDOWN"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"

MODIFY
instrumentation/lettuce-5.0/src/test/groovy/LettuceSyncClientTest.groovy
instrumentation/lettuce-5.0/src/test/groovy/LettuceSyncClientTest.groovy
@@ -28,7 +28,6 @@ import spock.lang.Shared
import java.util.concurrent.CompletionException
-import static io.opentelemetry.auto.instrumentation.lettuce.LettuceInstrumentationUtil.AGENT_CRASHING_COMMAND_PREFIX
import static io.opentelemetry.trace.Span.Kind.CLIENT
class LettuceSyncClientTest extends AgentTestRunner {
@@ -112,12 +111,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "CONNECT"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "CONNECT:" + dbAddr
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$MoreTags.NET_PEER_NAME" HOST
@@ -146,12 +144,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "CONNECT"
spanKind CLIENT
errored true
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "CONNECT:" + dbAddrNonExistent
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$MoreTags.NET_PEER_NAME" HOST
@@ -174,12 +171,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "SET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -198,12 +194,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "GET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "GET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -222,12 +217,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "GET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "GET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -246,12 +240,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "RANDOMKEY"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "RANDOMKEY"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -270,12 +263,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "LPUSH"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "LPUSH"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -294,12 +286,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "HMSET"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "HMSET"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -318,12 +309,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "HGETALL"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "HGETALL"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -341,12 +331,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "DEBUG"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" AGENT_CRASHING_COMMAND_PREFIX + "DEBUG"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"
@@ -364,12 +353,11 @@ class LettuceSyncClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
- operationName "redis.query"
+ operationName "SHUTDOWN"
spanKind CLIENT
errored false
tags {
"$MoreTags.SERVICE_NAME" "redis"
- "$MoreTags.RESOURCE_NAME" "SHUTDOWN"
"$MoreTags.SPAN_TYPE" SpanTypes.REDIS
"$Tags.COMPONENT" "redis-client"
"$Tags.DB_TYPE" "redis"

Better span names for redis (#239)