Skip to content

Commit

Permalink
Remove db.connection_string from redis instrumentation (#3094)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored May 27, 2021
1 parent c8ecd9a commit df0d028
Show file tree
Hide file tree
Showing 14 changed files with 3 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected String name(JedisRequest request) {

@Override
protected String connectionString(JedisRequest request) {
return request.getConnectionString();
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ public abstract class JedisRequest {

public abstract List<byte[]> getArgs();

public String getConnectionString() {
return getConnection().getHost() + ":" + getConnection().getPort();
}

public static JedisRequest create(Connection connection, Protocol.Command command) {
return new AutoValue_JedisRequest(connection, command, emptyList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class JedisClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "SET foo ?"
"$SemanticAttributes.DB_OPERATION.key" "SET"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand All @@ -75,7 +74,6 @@ class JedisClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "SET foo ?"
"$SemanticAttributes.DB_OPERATION.key" "SET"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand All @@ -89,7 +87,6 @@ class JedisClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "GET foo"
"$SemanticAttributes.DB_OPERATION.key" "GET"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand All @@ -115,7 +112,6 @@ class JedisClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "SET foo ?"
"$SemanticAttributes.DB_OPERATION.key" "SET"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand All @@ -129,7 +125,6 @@ class JedisClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "RANDOMKEY"
"$SemanticAttributes.DB_OPERATION.key" "RANDOMKEY"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected String dbSystem(Connection connection) {

@Override
protected String dbConnectionString(Connection connection) {
return connection.getHost() + ":" + connection.getPort();
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Jedis30ClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "SET foo ?"
"$SemanticAttributes.NET_PEER_IP.key" "127.0.0.1"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand All @@ -75,7 +74,6 @@ class Jedis30ClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "SET foo ?"
"$SemanticAttributes.NET_PEER_IP.key" "127.0.0.1"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand All @@ -89,7 +87,6 @@ class Jedis30ClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "GET foo"
"$SemanticAttributes.NET_PEER_IP.key" "127.0.0.1"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand All @@ -115,7 +112,6 @@ class Jedis30ClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "SET foo ?"
"$SemanticAttributes.NET_PEER_IP.key" "127.0.0.1"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand All @@ -129,7 +125,6 @@ class Jedis30ClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_CONNECTION_STRING.key" "localhost:$port"
"$SemanticAttributes.DB_STATEMENT.key" "RANDOMKEY"
"$SemanticAttributes.NET_PEER_IP.key" "127.0.0.1"
"$SemanticAttributes.NET_PEER_NAME.key" "localhost"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class LettuceReactiveClientTest extends AbstractLettuceReactiveClientTest implem
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "SET a ?"
}
Expand All @@ -67,7 +66,6 @@ class LettuceReactiveClientTest extends AbstractLettuceReactiveClientTest implem
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "GET a"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,5 @@ private void finish(Span span) {
private static void fillEndpoint(AttributeSetter span, OpenTelemetryEndpoint endpoint) {
span.setAttribute(SemanticAttributes.NET_TRANSPORT, IP_TCP);
NetPeerAttributes.INSTANCE.setNetPeer(span, endpoint.name, endpoint.ip, endpoint.port);

StringBuilder redisUrl =
new StringBuilder("redis://").append(endpoint.name != null ? endpoint.name : endpoint.ip);
if (endpoint.port > 0) {
redisUrl.append(":").append(endpoint.port);
}

span.setAttribute(SemanticAttributes.DB_CONNECTION_STRING, redisUrl.toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "SET TESTSETKEY ?"
}
Expand Down Expand Up @@ -188,7 +187,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "GET TESTKEY"
}
Expand Down Expand Up @@ -244,7 +242,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "GET NON_EXISTENT_KEY"
}
Expand Down Expand Up @@ -286,7 +283,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_STATEMENT.key}" "RANDOMKEY"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
}
Expand Down Expand Up @@ -346,7 +342,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "HMSET TESTHM firstname ? lastname ? age ?"
}
Expand All @@ -366,7 +361,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "HGETALL TESTHM"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "SET TESTSETKEY ?"
}
Expand Down Expand Up @@ -128,7 +127,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "GET TESTKEY"
}
Expand Down Expand Up @@ -169,7 +167,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "GET NON_EXISTENT_KEY"
}
Expand Down Expand Up @@ -208,7 +205,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_STATEMENT.key}" "RANDOMKEY"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
}
Expand Down Expand Up @@ -237,7 +233,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_STATEMENT.key}" "COMMAND"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
}
Expand Down Expand Up @@ -285,7 +280,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "SET a ?"
}
Expand All @@ -304,7 +298,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "GET a"
}
Expand Down Expand Up @@ -343,7 +336,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "SET a ?"
}
Expand All @@ -362,7 +354,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "GET a"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ abstract class AbstractLettuceSyncClientAuthTest extends InstrumentationSpecific
"${SemanticAttributes.NET_TRANSPORT.key}" IP_TCP
"${SemanticAttributes.NET_PEER_IP.key}" "127.0.0.1"
"${SemanticAttributes.NET_PEER_PORT.key}" port
"${SemanticAttributes.DB_CONNECTION_STRING.key}" "redis://127.0.0.1:$port"
"${SemanticAttributes.DB_SYSTEM.key}" "redis"
"${SemanticAttributes.DB_STATEMENT.key}" "AUTH ?"
}
Expand Down
Loading

0 comments on commit df0d028

Please sign in to comment.