Update lettuce-5.0 to Instrumenter API (#3125)

This commit is contained in:
Trask Stalnaker 2021-05-31 07:49:25 -07:00 committed by GitHub
parent 3c8874d536
commit 7d46c336b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 294 additions and 161 deletions

View File

@ -0,0 +1,57 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceInstrumenters.instrumenter;
import io.lettuce.core.protocol.RedisCommand;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.config.Config;
import java.util.concurrent.CancellationException;
import java.util.function.BiFunction;
/**
* Callback class to close the command span on an error or a success in the RedisFuture returned by
* the lettuce async API.
*
* @param <T> the normal completion result
* @param <U> the error
* @param <R> the return type, should be null since nothing else should happen from tracing
* standpoint after the span is closed
*/
public class EndCommandAsyncBiFunction<T, U extends Throwable, R>
implements BiFunction<T, Throwable, R> {
private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES =
Config.get()
.getBooleanProperty("otel.instrumentation.lettuce.experimental-span-attributes", false);
private final Context context;
private final RedisCommand<?, ?, ?> command;
public EndCommandAsyncBiFunction(Context context, RedisCommand<?, ?, ?> command) {
this.context = context;
this.command = command;
}
@Override
public R apply(T t, Throwable throwable) {
end(context, command, throwable);
return null;
}
public static void end(Context context, RedisCommand<?, ?, ?> command, Throwable throwable) {
if (throwable instanceof CancellationException) {
if (CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES) {
Span.fromContext(context).setAttribute("lettuce.command.cancelled", true);
}
// and don't report this as an error
throwable = null;
}
instrumenter().end(context, command, null, throwable);
}
}

View File

@ -5,8 +5,9 @@
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceDatabaseClientTracer.tracer;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceInstrumenters.connectInstrumenter;
import io.lettuce.core.RedisURI;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Context;
import io.opentelemetry.instrumentation.api.config.Config;
@ -14,15 +15,15 @@ import java.util.concurrent.CancellationException;
import java.util.function.BiFunction;
/**
* Callback class to close the span on an error or a success in the RedisFuture returned by the
* lettuce async API.
* Callback class to close the connect span on an error or a success in the RedisFuture returned by
* the lettuce async API.
*
* @param <T> the normal completion result
* @param <U> the error
* @param <R> the return type, should be null since nothing else should happen from tracing
* standpoint after the span is closed
*/
public class LettuceAsyncBiFunction<T, U extends Throwable, R>
public class EndConnectAsyncBiFunction<T, U extends Throwable, R>
implements BiFunction<T, Throwable, R> {
private static final boolean CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES =
@ -30,23 +31,23 @@ public class LettuceAsyncBiFunction<T, U extends Throwable, R>
.getBooleanProperty("otel.instrumentation.lettuce.experimental-span-attributes", false);
private final Context context;
private final RedisURI request;
public LettuceAsyncBiFunction(Context context) {
public EndConnectAsyncBiFunction(Context context, RedisURI request) {
this.context = context;
this.request = request;
}
@Override
public R apply(T t, Throwable throwable) {
if (throwable == null) {
tracer().end(context);
} else if (throwable instanceof CancellationException) {
if (throwable instanceof CancellationException) {
if (CAPTURE_EXPERIMENTAL_SPAN_ATTRIBUTES) {
Span.fromContext(context).setAttribute("lettuce.command.cancelled", true);
}
tracer().end(context);
} else {
tracer().endExceptionally(context, throwable);
// and don't report this as an error
throwable = null;
}
connectInstrumenter().end(context, request, null, throwable);
return null;
}
}

View File

@ -1,51 +0,0 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import io.lettuce.core.RedisURI;
import io.opentelemetry.api.trace.SpanBuilder;
import io.opentelemetry.instrumentation.api.tracer.DatabaseClientTracer;
import io.opentelemetry.instrumentation.api.tracer.net.NetPeerAttributes;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes.DbSystemValues;
import java.net.InetSocketAddress;
public abstract class LettuceAbstractDatabaseClientTracer<STATEMENT>
extends DatabaseClientTracer<RedisURI, STATEMENT, String> {
protected LettuceAbstractDatabaseClientTracer() {
super(NetPeerAttributes.INSTANCE);
}
@Override
protected String getInstrumentationName() {
return "io.opentelemetry.javaagent.lettuce-5.0";
}
@Override
protected String dbSystem(RedisURI connection) {
return DbSystemValues.REDIS;
}
@Override
protected InetSocketAddress peerAddress(RedisURI redisUri) {
return new InetSocketAddress(redisUri.getHost(), redisUri.getPort());
}
@Override
public void onConnection(SpanBuilder span, RedisURI connection) {
if (connection != null && connection.getDatabase() != 0) {
span.setAttribute(
SemanticAttributes.DB_REDIS_DATABASE_INDEX, (long) connection.getDatabase());
}
super.onConnection(span, connection);
}
@Override
protected String dbStatement(
RedisURI connection, STATEMENT statement, String sanitizedStatement) {
return sanitizedStatement;
}
}

View File

@ -6,8 +6,8 @@
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import static io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge.currentContext;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceDatabaseClientTracer.tracer;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceInstrumentationUtil.expectsResponse;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceInstrumenters.instrumenter;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.named;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
@ -46,7 +46,7 @@ public class LettuceAsyncCommandsInstrumentation implements TypeInstrumentation
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope) {
context = tracer().startSpan(currentContext(), null, command);
context = instrumenter().start(currentContext(), command);
scope = context.makeCurrent();
}
@ -60,15 +60,15 @@ public class LettuceAsyncCommandsInstrumentation implements TypeInstrumentation
scope.close();
if (throwable != null) {
tracer().endExceptionally(context, throwable);
instrumenter().end(context, command, null, throwable);
return;
}
// close spans on error or normal completion
if (expectsResponse(command)) {
asyncCommand.handleAsync(new LettuceAsyncBiFunction<>(context));
asyncCommand.handleAsync(new EndCommandAsyncBiFunction<>(context, command));
} else {
tracer().end(context);
instrumenter().end(context, command, null, null);
}
}
}

View File

@ -6,7 +6,7 @@
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import static io.opentelemetry.javaagent.instrumentation.api.Java8BytecodeBridge.currentContext;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceConnectionDatabaseClientTracer.tracer;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceInstrumenters.connectInstrumenter;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.isPrivate;
import static net.bytebuddy.matcher.ElementMatchers.nameEndsWith;
@ -51,12 +51,13 @@ public class LettuceClientInstrumentation implements TypeInstrumentation {
@Advice.Argument(1) RedisURI redisUri,
@Advice.Local("otelContext") Context context,
@Advice.Local("otelScope") Scope scope) {
context = tracer().startSpan(currentContext(), redisUri, "CONNECT");
context = connectInstrumenter().start(currentContext(), redisUri);
scope = context.makeCurrent();
}
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
public static void stopSpan(
@Advice.Argument(1) RedisURI redisUri,
@Advice.Thrown Throwable throwable,
@Advice.Return ConnectionFuture<?> connectionFuture,
@Advice.Local("otelContext") Context context,
@ -64,10 +65,10 @@ public class LettuceClientInstrumentation implements TypeInstrumentation {
scope.close();
if (throwable != null) {
tracer().endExceptionally(context, throwable);
connectInstrumenter().end(context, redisUri, null, throwable);
return;
}
connectionFuture.handleAsync(new LettuceAsyncBiFunction<>(context));
connectionFuture.handleAsync(new EndConnectAsyncBiFunction<>(context, redisUri));
}
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import io.lettuce.core.RedisURI;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
final class LettuceConnectAttributesExtractor extends AttributesExtractor<RedisURI, Void> {
@Override
protected void onStart(AttributesBuilder attributes, RedisURI redisUri) {
attributes.put(SemanticAttributes.DB_SYSTEM, SemanticAttributes.DbSystemValues.REDIS);
int database = redisUri.getDatabase();
if (database != 0) {
attributes.put(SemanticAttributes.DB_REDIS_DATABASE_INDEX, (long) database);
}
}
@Override
protected void onEnd(AttributesBuilder attributes, RedisURI redisUri, Void ignored) {}
}

View File

@ -1,28 +0,0 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import io.lettuce.core.RedisURI;
public class LettuceConnectionDatabaseClientTracer
extends LettuceAbstractDatabaseClientTracer<String> {
private static final LettuceConnectionDatabaseClientTracer TRACER =
new LettuceConnectionDatabaseClientTracer();
public static LettuceConnectionDatabaseClientTracer tracer() {
return TRACER;
}
@Override
protected String sanitizeStatement(String command) {
return command;
}
@Override
protected String spanName(RedisURI connection, String command, String ignored) {
return command;
}
}

View File

@ -1,38 +0,0 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import io.lettuce.core.RedisURI;
import io.lettuce.core.protocol.RedisCommand;
import io.opentelemetry.instrumentation.api.db.RedisCommandSanitizer;
import io.opentelemetry.instrumentation.lettuce.common.LettuceArgSplitter;
import java.util.Collections;
import java.util.List;
public class LettuceDatabaseClientTracer
extends LettuceAbstractDatabaseClientTracer<RedisCommand<?, ?, ?>> {
private static final LettuceDatabaseClientTracer TRACER = new LettuceDatabaseClientTracer();
public static LettuceDatabaseClientTracer tracer() {
return TRACER;
}
@Override
protected String sanitizeStatement(RedisCommand<?, ?, ?> redisCommand) {
String command = LettuceInstrumentationUtil.getCommandName(redisCommand);
List<String> args =
redisCommand.getArgs() == null
? Collections.emptyList()
: LettuceArgSplitter.splitArgs(redisCommand.getArgs().toCommandString());
return RedisCommandSanitizer.sanitize(command, args);
}
@Override
protected String spanName(
RedisURI connection, RedisCommand<?, ?, ?> command, String sanitizedStatement) {
return LettuceInstrumentationUtil.getCommandName(command);
}
}

View File

@ -0,0 +1,56 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import io.lettuce.core.protocol.RedisCommand;
import io.opentelemetry.instrumentation.api.db.RedisCommandSanitizer;
import io.opentelemetry.instrumentation.api.instrumenter.db.DbAttributesExtractor;
import io.opentelemetry.instrumentation.lettuce.common.LettuceArgSplitter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.util.Collections;
import java.util.List;
import org.checkerframework.checker.nullness.qual.Nullable;
final class LettuceDbAttributesExtractor
extends DbAttributesExtractor<RedisCommand<?, ?, ?>, Void> {
@Override
protected String system(RedisCommand<?, ?, ?> request) {
return SemanticAttributes.DbSystemValues.REDIS;
}
@Override
@Nullable
protected String user(RedisCommand<?, ?, ?> request) {
return null;
}
@Override
@Nullable
protected String name(RedisCommand<?, ?, ?> request) {
return null;
}
@Override
@Nullable
protected String connectionString(RedisCommand<?, ?, ?> request) {
return null;
}
@Override
protected String statement(RedisCommand<?, ?, ?> request) {
String command = LettuceInstrumentationUtil.getCommandName(request);
List<String> args =
request.getArgs() == null
? Collections.emptyList()
: LettuceArgSplitter.splitArgs(request.getArgs().toCommandString());
return RedisCommandSanitizer.sanitize(command, args);
}
@Override
protected String operation(RedisCommand<?, ?, ?> request) {
return request.getType().name();
}
}

View File

@ -0,0 +1,56 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import io.lettuce.core.RedisURI;
import io.lettuce.core.protocol.RedisCommand;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.instrumentation.api.instrumenter.SpanKindExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.db.DbAttributesExtractor;
import io.opentelemetry.instrumentation.api.instrumenter.db.DbSpanNameExtractor;
import io.opentelemetry.javaagent.instrumentation.api.instrumenter.PeerServiceAttributesExtractor;
public final class LettuceInstrumenters {
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.javaagent.jedis-5.0";
private static final Instrumenter<RedisCommand<?, ?, ?>, Void> INSTRUMENTER;
private static final Instrumenter<RedisURI, Void> CONNECT_INSTRUMENTER;
static {
DbAttributesExtractor<RedisCommand<?, ?, ?>, Void> attributesExtractor =
new LettuceDbAttributesExtractor();
SpanNameExtractor<RedisCommand<?, ?, ?>> spanName =
DbSpanNameExtractor.create(attributesExtractor);
INSTRUMENTER =
Instrumenter.<RedisCommand<?, ?, ?>, Void>newBuilder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, spanName)
.addAttributesExtractor(attributesExtractor)
.newInstrumenter(SpanKindExtractor.alwaysClient());
LettuceNetAttributesExtractor netAttributesExtractor = new LettuceNetAttributesExtractor();
CONNECT_INSTRUMENTER =
Instrumenter.<RedisURI, Void>newBuilder(
GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, redisUri -> "CONNECT")
.addAttributesExtractor(netAttributesExtractor)
.addAttributesExtractor(PeerServiceAttributesExtractor.create(netAttributesExtractor))
.addAttributesExtractor(new LettuceConnectAttributesExtractor())
.newInstrumenter(SpanKindExtractor.alwaysClient());
}
public static Instrumenter<RedisCommand<?, ?, ?>, Void> instrumenter() {
return INSTRUMENTER;
}
public static Instrumenter<RedisURI, Void> connectInstrumenter() {
return CONNECT_INSTRUMENTER;
}
private LettuceInstrumenters() {}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0;
import io.lettuce.core.RedisURI;
import io.opentelemetry.instrumentation.api.instrumenter.net.NetAttributesExtractor;
import org.checkerframework.checker.nullness.qual.Nullable;
final class LettuceNetAttributesExtractor extends NetAttributesExtractor<RedisURI, Void> {
@Override
@Nullable
public String transport(RedisURI redisUri) {
return null;
}
@Override
public String peerName(RedisURI redisUri, @Nullable Void ignored) {
return redisUri.getHost();
}
@Override
public Integer peerPort(RedisURI redisUri, @Nullable Void ignored) {
return redisUri.getPort();
}
@Override
@Nullable
public String peerIp(RedisURI redisUri, @Nullable Void ignored) {
return null;
}
}

View File

@ -5,7 +5,7 @@
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.rx;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceDatabaseClientTracer.tracer;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceInstrumenters.instrumenter;
import io.lettuce.core.protocol.RedisCommand;
import io.opentelemetry.api.trace.Span;
@ -45,11 +45,7 @@ public class LettuceFluxTerminationRunnable implements Consumer<Signal<?>>, Runn
span.setAttribute("lettuce.command.cancelled", true);
}
}
if (throwable == null) {
tracer().end(context);
} else {
tracer().endExceptionally(context, throwable);
}
instrumenter().end(context, onSubscribeConsumer.command, null, throwable);
} else {
LoggerFactory.getLogger(Flux.class)
.error(
@ -90,9 +86,9 @@ public class LettuceFluxTerminationRunnable implements Consumer<Signal<?>>, Runn
@Override
public void accept(Subscription subscription) {
owner.context = tracer().startSpan(Context.current(), null, command);
owner.context = instrumenter().start(Context.current(), command);
if (!expectsResponse) {
tracer().end(owner.context);
instrumenter().end(owner.context, command, null, null);
}
}
}

View File

@ -5,7 +5,7 @@
package io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.rx;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceDatabaseClientTracer.tracer;
import static io.opentelemetry.javaagent.instrumentation.lettuce.v5_0.LettuceInstrumenters.instrumenter;
import io.lettuce.core.protocol.RedisCommand;
import io.opentelemetry.context.Context;
@ -27,20 +27,16 @@ public class LettuceMonoDualConsumer<R, T> implements Consumer<R>, BiConsumer<T,
@Override
public void accept(R r) {
context = tracer().startSpan(Context.current(), null, command);
context = instrumenter().start(Context.current(), command);
if (finishSpanOnClose) {
tracer().end(context);
instrumenter().end(context, command, null, null);
}
}
@Override
public void accept(T t, Throwable throwable) {
if (context != null) {
if (throwable == null) {
tracer().end(context);
} else {
tracer().endExceptionally(context, throwable);
}
instrumenter().end(context, command, null, throwable);
} else {
LoggerFactory.getLogger(Mono.class)
.error(

View File

@ -116,10 +116,8 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.NET_PEER_NAME.key" PEER_NAME
"$SemanticAttributes.NET_PEER_IP.key" PEER_IP
"$SemanticAttributes.NET_PEER_PORT.key" port
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "CONNECT"
}
}
}
@ -151,10 +149,8 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
errorEvent AbstractChannel.AnnotatedConnectException, String
attributes {
"$SemanticAttributes.NET_PEER_NAME.key" PEER_NAME
"$SemanticAttributes.NET_PEER_IP.key" PEER_IP
"$SemanticAttributes.NET_PEER_PORT.key" incorrectPort
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "CONNECT"
}
}
}
@ -176,6 +172,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SET TESTSETKEY ?"
"$SemanticAttributes.DB_OPERATION.key" "SET"
}
}
}
@ -208,6 +205,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "GET TESTKEY"
"$SemanticAttributes.DB_OPERATION.key" "GET"
}
}
}
@ -254,6 +252,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "GET NON_EXISTENT_KEY"
"$SemanticAttributes.DB_OPERATION.key" "GET"
}
}
}
@ -286,6 +285,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "RANDOMKEY"
"$SemanticAttributes.DB_OPERATION.key" "RANDOMKEY"
}
}
}
@ -336,6 +336,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "HMSET TESTHM firstname ? lastname ? age ?"
"$SemanticAttributes.DB_OPERATION.key" "HMSET"
}
}
}
@ -346,6 +347,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "HGETALL TESTHM"
"$SemanticAttributes.DB_OPERATION.key" "HGETALL"
}
}
}
@ -388,6 +390,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "DEL key1 key2"
"$SemanticAttributes.DB_OPERATION.key" "DEL"
}
}
}
@ -422,6 +425,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SADD SKEY ? ?"
"$SemanticAttributes.DB_OPERATION.key" "SADD"
"lettuce.command.cancelled" true
}
}
@ -442,6 +446,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "DEBUG SEGFAULT"
"$SemanticAttributes.DB_OPERATION.key" "DEBUG"
}
}
}
@ -462,6 +467,7 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SHUTDOWN NOSAVE"
"$SemanticAttributes.DB_OPERATION.key" "SHUTDOWN"
}
}
}

View File

@ -93,6 +93,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SET TESTSETKEY ?"
"$SemanticAttributes.DB_OPERATION.key" "SET"
}
}
}
@ -116,6 +117,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "GET TESTKEY"
"$SemanticAttributes.DB_OPERATION.key" "GET"
}
}
}
@ -147,6 +149,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "GET NON_EXISTENT_KEY"
"$SemanticAttributes.DB_OPERATION.key" "GET"
}
}
}
@ -176,6 +179,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "RANDOMKEY"
"$SemanticAttributes.DB_OPERATION.key" "RANDOMKEY"
}
}
}
@ -195,6 +199,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
"$SemanticAttributes.DB_OPERATION.key" "COMMAND"
"lettuce.command.results.count" { it > 100 }
}
}
@ -215,6 +220,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
"$SemanticAttributes.DB_OPERATION.key" "COMMAND"
"lettuce.command.cancelled" true
"lettuce.command.results.count" 2
}
@ -245,6 +251,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "DEBUG SEGFAULT"
"$SemanticAttributes.DB_OPERATION.key" "DEBUG"
}
}
}
@ -264,6 +271,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SHUTDOWN NOSAVE"
"$SemanticAttributes.DB_OPERATION.key" "SHUTDOWN"
}
}
}
@ -293,6 +301,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SET a ?"
"$SemanticAttributes.DB_OPERATION.key" "SET"
}
}
span(2) {
@ -302,6 +311,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "GET a"
"$SemanticAttributes.DB_OPERATION.key" "GET"
}
}
}
@ -331,6 +341,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SET a ?"
"$SemanticAttributes.DB_OPERATION.key" "SET"
}
}
span(2) {
@ -340,6 +351,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "GET a"
"$SemanticAttributes.DB_OPERATION.key" "GET"
}
}
}
@ -370,6 +382,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SET a ?"
"$SemanticAttributes.DB_OPERATION.key" "SET"
}
}
span(2) {
@ -379,6 +392,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "GET a"
"$SemanticAttributes.DB_OPERATION.key" "GET"
}
}
}

View File

@ -97,10 +97,8 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
kind CLIENT
attributes {
"$SemanticAttributes.NET_PEER_NAME.key" PEER_NAME
"$SemanticAttributes.NET_PEER_IP.key" PEER_IP
"$SemanticAttributes.NET_PEER_PORT.key" port
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "CONNECT"
}
}
}
@ -129,10 +127,8 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
errorEvent AbstractChannel.AnnotatedConnectException, String
attributes {
"$SemanticAttributes.NET_PEER_NAME.key" PEER_NAME
"$SemanticAttributes.NET_PEER_IP.key" PEER_IP
"$SemanticAttributes.NET_PEER_PORT.key" incorrectPort
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "CONNECT"
}
}
}
@ -153,6 +149,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SET TESTSETKEY ?"
"$SemanticAttributes.DB_OPERATION.key" "SET"
}
}
}
@ -173,6 +170,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "GET TESTKEY"
"$SemanticAttributes.DB_OPERATION.key" "GET"
}
}
}
@ -193,6 +191,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "GET NON_EXISTENT_KEY"
"$SemanticAttributes.DB_OPERATION.key" "GET"
}
}
}
@ -213,6 +212,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "RANDOMKEY"
"$SemanticAttributes.DB_OPERATION.key" "RANDOMKEY"
}
}
}
@ -233,6 +233,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "LPUSH TESTLIST ?"
"$SemanticAttributes.DB_OPERATION.key" "LPUSH"
}
}
}
@ -253,6 +254,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "HMSET user firstname ? lastname ? age ?"
"$SemanticAttributes.DB_OPERATION.key" "HMSET"
}
}
}
@ -273,6 +275,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "HGETALL TESTHM"
"$SemanticAttributes.DB_OPERATION.key" "HGETALL"
}
}
}
@ -292,6 +295,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "DEBUG SEGFAULT"
"$SemanticAttributes.DB_OPERATION.key" "DEBUG"
}
}
}
@ -311,6 +315,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
attributes {
"$SemanticAttributes.DB_SYSTEM.key" "redis"
"$SemanticAttributes.DB_STATEMENT.key" "SHUTDOWN NOSAVE"
"$SemanticAttributes.DB_OPERATION.key" "SHUTDOWN"
}
}
}