Skip to content

Commit 6568e1d

Browse files
committed
only for stable semconv
1 parent 953f43a commit 6568e1d

File tree

1 file changed

+15
-4
lines changed
  • instrumentation/lettuce/lettuce-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0

1 file changed

+15
-4
lines changed

instrumentation/lettuce/lettuce-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/lettuce/v4_0/LettuceAsyncClientTest.java

+15-4
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@
3131
import com.lambdaworks.redis.protocol.AsyncCommand;
3232
import io.opentelemetry.api.common.Attributes;
3333
import io.opentelemetry.api.trace.SpanKind;
34+
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
3435
import io.opentelemetry.instrumentation.test.utils.PortUtils;
3536
import io.opentelemetry.instrumentation.testing.internal.AutoCleanupExtension;
3637
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
3738
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
39+
import io.opentelemetry.sdk.testing.assertj.AttributeAssertion;
3840
import io.opentelemetry.sdk.trace.data.StatusData;
41+
import java.util.ArrayList;
42+
import java.util.Arrays;
43+
import java.util.List;
3944
import java.util.Map;
4045
import java.util.concurrent.CancellationException;
4146
import java.util.concurrent.CompletableFuture;
@@ -413,6 +418,15 @@ void testCommandCompletesExceptionally() {
413418
assertThat(completedExceptionally).isTrue();
414419
});
415420

421+
List<AttributeAssertion> assertions =
422+
new ArrayList<>(
423+
Arrays.asList(
424+
equalTo(maybeStable(DB_SYSTEM), "redis"),
425+
equalTo(maybeStable(DB_OPERATION), "DEL")));
426+
if (SemconvStability.emitStableDatabaseSemconv()) {
427+
assertions.add(equalTo(ERROR_TYPE, "java.lang.IllegalStateException"));
428+
}
429+
416430
testing.waitAndAssertTraces(
417431
trace ->
418432
trace.hasSpansSatisfyingExactly(
@@ -421,10 +435,7 @@ void testCommandCompletesExceptionally() {
421435
.hasKind(SpanKind.CLIENT)
422436
.hasStatus(StatusData.error())
423437
.hasException(new IllegalStateException("TestException"))
424-
.hasAttributesSatisfyingExactly(
425-
equalTo(maybeStable(DB_SYSTEM), "redis"),
426-
equalTo(maybeStable(DB_OPERATION), "DEL"),
427-
equalTo(ERROR_TYPE, "java.lang.IllegalStateException"))));
438+
.hasAttributesSatisfyingExactly(assertions)));
428439
}
429440

430441
@Test

0 commit comments

Comments
 (0)