Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LettuceAsyncClientTest extends AbstractLettuceAsyncClientTest {
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();

@Override
public InstrumentationExtension getInstrumentationExtension() {
public InstrumentationExtension testing() {
return testing;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LettuceReactiveClientTest extends AbstractLettuceReactiveClientTest {
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();

@Override
public InstrumentationExtension getInstrumentationExtension() {
public InstrumentationExtension testing() {
return testing;
}

Expand All @@ -38,12 +38,12 @@ protected RedisClient createClient(String uri) {
@SuppressWarnings("deprecation") // using deprecated semconv
@Test
void testAsyncSubscriberWithSpecificThreadPool() {
getInstrumentationExtension()
testing()
.runWithSpan(
"test-parent",
() -> reactiveCommands.set("a", "1").then(reactiveCommands.get("a")).subscribe());

getInstrumentationExtension()
testing()
.waitAndAssertTraces(
trace ->
trace.hasSpansSatisfyingExactly(
Expand All @@ -53,13 +53,14 @@ void testAsyncSubscriberWithSpecificThreadPool() {
.hasKind(SpanKind.CLIENT)
.hasParent(trace.getSpan(0))
.hasAttributesSatisfyingExactly(
equalTo(NetworkAttributes.NETWORK_TYPE, "ipv4"),
equalTo(NetworkAttributes.NETWORK_PEER_ADDRESS, ip),
equalTo(NetworkAttributes.NETWORK_PEER_PORT, port),
equalTo(ServerAttributes.SERVER_ADDRESS, host),
equalTo(ServerAttributes.SERVER_PORT, port),
equalTo(DbIncubatingAttributes.DB_SYSTEM, "redis"),
equalTo(DbIncubatingAttributes.DB_STATEMENT, "SET a ?"))
addExtraAttributes(
equalTo(NetworkAttributes.NETWORK_TYPE, "ipv4"),
equalTo(NetworkAttributes.NETWORK_PEER_ADDRESS, ip),
equalTo(NetworkAttributes.NETWORK_PEER_PORT, port),
equalTo(ServerAttributes.SERVER_ADDRESS, host),
equalTo(ServerAttributes.SERVER_PORT, port),
equalTo(DbIncubatingAttributes.DB_SYSTEM, "redis"),
equalTo(DbIncubatingAttributes.DB_STATEMENT, "SET a ?")))
.hasEventsSatisfyingExactly(
event -> event.hasName("redis.encode.start"),
event -> event.hasName("redis.encode.end")),
Expand All @@ -68,13 +69,14 @@ void testAsyncSubscriberWithSpecificThreadPool() {
.hasKind(SpanKind.CLIENT)
.hasParent(trace.getSpan(0))
.hasAttributesSatisfyingExactly(
equalTo(NetworkAttributes.NETWORK_TYPE, "ipv4"),
equalTo(NetworkAttributes.NETWORK_PEER_ADDRESS, ip),
equalTo(NetworkAttributes.NETWORK_PEER_PORT, port),
equalTo(ServerAttributes.SERVER_ADDRESS, host),
equalTo(ServerAttributes.SERVER_PORT, port),
equalTo(DbIncubatingAttributes.DB_SYSTEM, "redis"),
equalTo(DbIncubatingAttributes.DB_STATEMENT, "GET a"))
addExtraAttributes(
equalTo(NetworkAttributes.NETWORK_TYPE, "ipv4"),
equalTo(NetworkAttributes.NETWORK_PEER_ADDRESS, ip),
equalTo(NetworkAttributes.NETWORK_PEER_PORT, port),
equalTo(ServerAttributes.SERVER_ADDRESS, host),
equalTo(ServerAttributes.SERVER_PORT, port),
equalTo(DbIncubatingAttributes.DB_SYSTEM, "redis"),
equalTo(DbIncubatingAttributes.DB_STATEMENT, "GET a")))
.hasEventsSatisfyingExactly(
event -> event.hasName("redis.encode.start"),
event -> event.hasName("redis.encode.end"))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LettuceSyncClientAuthTest extends AbstractLettuceSyncClientTest {
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();

@Override
public InstrumentationExtension getInstrumentationExtension() {
public InstrumentationExtension testing() {
return testing;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class LettuceSyncClientTest extends AbstractLettuceSyncClientTest {
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();

@Override
public InstrumentationExtension getInstrumentationExtension() {
public InstrumentationExtension testing() {
return testing;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public synchronized Tracer.Span start(RedisCommand<?, ?, ?> command) {
if (span == null) {
throw new IllegalStateException("Span started but null, this is a programming error.");
}
span.updateName(command.getType().name());
span.updateName(command.getType().toString());

if (command.getArgs() != null) {
argsList = OtelCommandArgsUtil.getCommandArgs(command.getArgs());
Expand Down Expand Up @@ -306,6 +306,9 @@ public synchronized Tracer.Span annotate(String value) {
@Override
@CanIgnoreReturnValue
public synchronized Tracer.Span tag(String key, String value) {
if (value == null || value.isEmpty()) {
return this;
}
if (key.equals("redis.args")) {
argsString = value;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ class LettuceAsyncClientTest extends AbstractLettuceAsyncClientTest {
static InstrumentationExtension testing = LibraryInstrumentationExtension.create();

@Override
public InstrumentationExtension getInstrumentationExtension() {
public InstrumentationExtension testing() {
return testing;
}

@Override
protected RedisClient createClient(String uri) {
return RedisClient.create(
ClientResources.builder()
.tracing(
LettuceTelemetry.create(getInstrumentationExtension().getOpenTelemetry())
.newTracing())
.tracing(LettuceTelemetry.create(testing().getOpenTelemetry()).newTracing())
.build(),
uri);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class LettuceReactiveClientTest extends AbstractLettuceReactiveClientTest {
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();

@Override
public InstrumentationExtension getInstrumentationExtension() {
public InstrumentationExtension testing() {
return testing;
}

Expand All @@ -29,9 +29,7 @@ public InstrumentationExtension getInstrumentationExtension() {
protected RedisClient createClient(String uri) {
return RedisClient.create(
ClientResources.builder()
.tracing(
LettuceTelemetry.create(getInstrumentationExtension().getOpenTelemetry())
.newTracing())
.tracing(LettuceTelemetry.create(testing().getOpenTelemetry()).newTracing())
.build(),
uri);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ class LettuceSyncClientAuthTest extends AbstractLettuceSyncClientAuthTest {
static InstrumentationExtension testing = LibraryInstrumentationExtension.create();

@Override
public InstrumentationExtension getInstrumentationExtension() {
public InstrumentationExtension testing() {
return testing;
}

@Override
protected RedisClient createClient(String uri) {
return RedisClient.create(
ClientResources.builder()
.tracing(
LettuceTelemetry.create(getInstrumentationExtension().getOpenTelemetry())
.newTracing())
.tracing(LettuceTelemetry.create(testing().getOpenTelemetry()).newTracing())
.build(),
uri);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ class LettuceSyncClientTest extends AbstractLettuceSyncClientTest {
static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();

@Override
public InstrumentationExtension getInstrumentationExtension() {
public InstrumentationExtension testing() {
return testing;
}

@Override
protected RedisClient createClient(String uri) {
return RedisClient.create(
ClientResources.builder()
.tracing(
LettuceTelemetry.create(getInstrumentationExtension().getOpenTelemetry())
.newTracing())
.tracing(LettuceTelemetry.create(testing().getOpenTelemetry()).newTracing())
.build(),
uri);
}
Expand Down
Loading
Loading