remove string constants in advice class and comment fixes
This commit is contained in:
parent
b694ecdf79
commit
0bc9d9c08d
|
@ -12,10 +12,6 @@ import net.bytebuddy.asm.Advice;
|
|||
|
||||
public class ConnectionFutureAdvice {
|
||||
|
||||
public static final String REDIS_URL_TAG_NAME = "db.redis.url";
|
||||
public static final String REDIS_DB_INDEX_TAG_NAME = "db.redis.dbIndex";
|
||||
public static final String RESOURCE_NAME_PREFIX = "CONNECT:";
|
||||
|
||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||
public static Scope startSpan(@Advice.Argument(1) final RedisURI redisURI) {
|
||||
final Scope scope = GlobalTracer.get().buildSpan("redis.query").startActive(false);
|
||||
|
@ -31,9 +27,9 @@ public class ConnectionFutureAdvice {
|
|||
Tags.PEER_HOSTNAME.set(span, redisHost);
|
||||
|
||||
final String url = redisHost + ":" + redisPort + "/" + redisURI.getDatabase();
|
||||
span.setTag(REDIS_URL_TAG_NAME, url);
|
||||
span.setTag(REDIS_DB_INDEX_TAG_NAME, redisURI.getDatabase());
|
||||
span.setTag(DDTags.RESOURCE_NAME, RESOURCE_NAME_PREFIX + url);
|
||||
span.setTag("db.redis.url", url);
|
||||
span.setTag("db.redis.dbIndex", redisURI.getDatabase());
|
||||
span.setTag(DDTags.RESOURCE_NAME, "CONNECT:" + url);
|
||||
span.setTag(DDTags.SERVICE_NAME, LettuceInstrumentationUtil.SERVICE_NAME);
|
||||
span.setTag(DDTags.SPAN_TYPE, LettuceInstrumentationUtil.SERVICE_NAME);
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ public class LettuceAsyncCommandsAdvice {
|
|||
Map<String, String> commandMap = LettuceInstrumentationUtil.getCommandInfo(command);
|
||||
String commandName = commandMap.get(LettuceInstrumentationUtil.MAP_KEY_CMD_NAME);
|
||||
String commandArgs = commandMap.get(LettuceInstrumentationUtil.MAP_KEY_CMD_ARGS);
|
||||
;
|
||||
|
||||
final Scope scope =
|
||||
GlobalTracer.get()
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.function.BiFunction
|
|||
import java.util.function.Consumer
|
||||
import java.util.function.Function
|
||||
|
||||
import static datadog.trace.instrumentation.lettuce.ConnectionFutureAdvice.RESOURCE_NAME_PREFIX
|
||||
import static datadog.trace.agent.test.ListWriterAssert.assertTraces
|
||||
|
||||
class LettuceAsyncClientTest extends AgentTestRunner {
|
||||
|
@ -90,7 +89,7 @@ class LettuceAsyncClientTest extends AgentTestRunner {
|
|||
serviceName "redis"
|
||||
operationName "redis.query"
|
||||
spanType "redis"
|
||||
resourceName RESOURCE_NAME_PREFIX + DB_ADDR
|
||||
resourceName "CONNECT:" + DB_ADDR
|
||||
errored false
|
||||
|
||||
tags {
|
||||
|
@ -128,7 +127,7 @@ class LettuceAsyncClientTest extends AgentTestRunner {
|
|||
serviceName "redis"
|
||||
operationName "redis.query"
|
||||
spanType "redis"
|
||||
resourceName RESOURCE_NAME_PREFIX + DB_ADDR_NON_EXISTENT
|
||||
resourceName "CONNECT:" + DB_ADDR_NON_EXISTENT
|
||||
errored true
|
||||
|
||||
tags {
|
||||
|
|
|
@ -9,7 +9,6 @@ import spock.lang.Shared
|
|||
|
||||
import java.util.concurrent.CompletionException
|
||||
|
||||
import static datadog.trace.instrumentation.lettuce.ConnectionFutureAdvice.RESOURCE_NAME_PREFIX
|
||||
import static datadog.trace.agent.test.ListWriterAssert.assertTraces
|
||||
|
||||
class LettuceSyncClientTest extends AgentTestRunner {
|
||||
|
@ -74,7 +73,7 @@ class LettuceSyncClientTest extends AgentTestRunner {
|
|||
serviceName "redis"
|
||||
operationName "redis.query"
|
||||
spanType "redis"
|
||||
resourceName RESOURCE_NAME_PREFIX + DB_ADDR
|
||||
resourceName "CONNECT:" + DB_ADDR
|
||||
errored false
|
||||
|
||||
tags {
|
||||
|
@ -108,7 +107,7 @@ class LettuceSyncClientTest extends AgentTestRunner {
|
|||
serviceName "redis"
|
||||
operationName "redis.query"
|
||||
spanType "redis"
|
||||
resourceName RESOURCE_NAME_PREFIX + DB_ADDR_NON_EXISTENT
|
||||
resourceName "CONNECT:" + DB_ADDR_NON_EXISTENT
|
||||
errored true
|
||||
|
||||
tags {
|
||||
|
|
Loading…
Reference in New Issue