From 80ca9ee0c34a8c6fac88d858e6bc3c678195d75a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 08:44:18 -0700 Subject: [PATCH 1/2] fix(deps): update quarkus packages to v3.5.0 (#9706) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- smoke-tests/images/quarkus/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smoke-tests/images/quarkus/build.gradle.kts b/smoke-tests/images/quarkus/build.gradle.kts index 205ad69f8d47..f240fa1cf535 100644 --- a/smoke-tests/images/quarkus/build.gradle.kts +++ b/smoke-tests/images/quarkus/build.gradle.kts @@ -12,11 +12,11 @@ plugins { id("otel.java-conventions") id("com.google.cloud.tools.jib") - id("io.quarkus") version "3.4.3" + id("io.quarkus") version "3.5.0" } dependencies { - implementation(enforcedPlatform("io.quarkus:quarkus-bom:3.4.3")) + implementation(enforcedPlatform("io.quarkus:quarkus-bom:3.5.0")) implementation("io.quarkus:quarkus-resteasy") } From ccb2955a55f8589aa7cdebbb4f903d88808bc3f4 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Wed, 18 Oct 2023 23:52:36 +0300 Subject: [PATCH 2/2] Fix redisson latest dep test (#9707) --- .../redisson/v3_17/RedissonClientTest.java | 5 ++ .../redisson/AbstractRedissonClientTest.java | 58 +++++++++++-------- 2 files changed, 39 insertions(+), 24 deletions(-) diff --git a/instrumentation/redisson/redisson-3.17/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/redisson/v3_17/RedissonClientTest.java b/instrumentation/redisson/redisson-3.17/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/redisson/v3_17/RedissonClientTest.java index 0d9a42ed95d9..a9c3fb3965c6 100644 --- a/instrumentation/redisson/redisson-3.17/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/redisson/v3_17/RedissonClientTest.java +++ b/instrumentation/redisson/redisson-3.17/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/redisson/v3_17/RedissonClientTest.java @@ -12,4 +12,9 @@ public class RedissonClientTest extends AbstractRedissonClientTest { protected boolean useRedisProtocol() { return true; } + + @Override + protected boolean lockHas3Traces() { + return Boolean.getBoolean("testLatestDeps"); + } } diff --git a/instrumentation/redisson/redisson-common/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/AbstractRedissonClientTest.java b/instrumentation/redisson/redisson-common/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/AbstractRedissonClientTest.java index f0a6ad7bf208..f49b2518b2bd 100644 --- a/instrumentation/redisson/redisson-common/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/AbstractRedissonClientTest.java +++ b/instrumentation/redisson/redisson-common/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/redisson/AbstractRedissonClientTest.java @@ -11,17 +11,19 @@ import static io.opentelemetry.instrumentation.testing.util.TelemetryDataUtil.orderByRootSpanName; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies; -import static java.util.regex.Pattern.compile; -import static java.util.regex.Pattern.quote; import static org.assertj.core.api.Assertions.assertThat; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; +import io.opentelemetry.sdk.testing.assertj.TraceAssert; import io.opentelemetry.semconv.SemanticAttributes; import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.function.Consumer; import org.junit.Assume; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -75,7 +77,7 @@ static void cleanupAll() { } @BeforeEach - void setup() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + void setup() throws InvocationTargetException, IllegalAccessException { String newAddress = address; if (useRedisProtocol()) { // Newer versions of redisson require scheme, older versions forbid it @@ -91,8 +93,7 @@ void setup() throws NoSuchMethodException, InvocationTargetException, IllegalAcc .getClass() .getMethod("setPingConnectionInterval", int.class) .invoke(singleServerConfig, 0); - } catch (NoSuchMethodException e) { - logger.warn("no setPingConnectionInterval method", e); + } catch (NoSuchMethodException ignored) { } redisson = Redisson.create(config); testing.clearData(); @@ -364,24 +365,9 @@ void lockCommand() { } finally { lock.unlock(); } - // Use .* to match the actual script, since it changes between redisson versions - // everything that does not change is quoted so that it's matched literally - String lockPattern = compile("^" + quote("EVAL ") + ".*" + quote(" 1 lock ? ?")).toString(); - - String unlockPattern = - compile( - "^" - + quote("EVAL ") - + ".*" - + quote(" 2 lock ") - + "\\S+" - + "(" - + quote(" ?") - + ")+$") - .toString(); - testing.waitAndAssertSortedTraces( - orderByRootSpanKind(SpanKind.CLIENT), + List> traceAsserts = new ArrayList<>(); + traceAsserts.add( trace -> trace.hasSpansSatisfyingExactly( span -> @@ -395,7 +381,8 @@ void lockCommand() { equalTo(SemanticAttributes.DB_OPERATION, "EVAL"), satisfies( SemanticAttributes.DB_STATEMENT, - stringAssert -> stringAssert.containsPattern(lockPattern)))), + stringAssert -> stringAssert.startsWith("EVAL"))))); + traceAsserts.add( trace -> trace.hasSpansSatisfyingExactly( span -> @@ -409,13 +396,36 @@ void lockCommand() { equalTo(SemanticAttributes.DB_OPERATION, "EVAL"), satisfies( SemanticAttributes.DB_STATEMENT, - stringAssert -> stringAssert.containsPattern(unlockPattern))))); + stringAssert -> stringAssert.startsWith("EVAL"))))); + if (lockHas3Traces()) { + traceAsserts.add( + trace -> + trace.hasSpansSatisfyingExactly( + span -> + span.hasName("DEL") + .hasKind(CLIENT) + .hasAttributesSatisfyingExactly( + equalTo(SemanticAttributes.NET_SOCK_PEER_ADDR, "127.0.0.1"), + equalTo(SemanticAttributes.NET_SOCK_PEER_NAME, "localhost"), + equalTo(SemanticAttributes.NET_SOCK_PEER_PORT, (long) port), + equalTo(SemanticAttributes.DB_SYSTEM, "redis"), + equalTo(SemanticAttributes.DB_OPERATION, "DEL"), + satisfies( + SemanticAttributes.DB_STATEMENT, + stringAssert -> stringAssert.startsWith("DEL"))))); + } + + testing.waitAndAssertSortedTraces(orderByRootSpanKind(SpanKind.CLIENT), traceAsserts); } protected boolean useRedisProtocol() { return Boolean.getBoolean("testLatestDeps"); } + protected boolean lockHas3Traces() { + return false; + } + protected RBatch createBatch(RedissonClient redisson) { return redisson.createBatch(BatchOptions.defaults()); }