Fix testLatestDeps in dubbo instrumentation
MODIFY
instrumentation/apache-dubbo-2.7/javaagent/build.gradle.kts
instrumentation/apache-dubbo-2.7/javaagent/build.gradle.kts
@@ -27,6 +27,4 @@ tasks.withType<Test>().configureEach {
jvmArgs("--add-opens=java.base/java.math=ALL-UNNAMED")
// required on jdk17
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
-
- systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
}

MODIFY
instrumentation/apache-dubbo-2.7/javaagent/src/test/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboTraceChainTest.groovy
instrumentation/apache-dubbo-2.7/javaagent/src/test/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboTraceChainTest.groovy
package io.opentelemetry.instrumentation.apachedubbo.v2_7
import io.opentelemetry.instrumentation.test.AgentTestTrait
-import spock.lang.IgnoreIf
-// TODO (trask) fix the test on latest version of dubbo
-@IgnoreIf({ Boolean.getBoolean("testLatestDeps") })
class DubboTraceChainTest extends AbstractDubboTraceChainTest implements AgentTestTrait {
}

MODIFY
instrumentation/apache-dubbo-2.7/library-autoconfigure/build.gradle.kts
instrumentation/apache-dubbo-2.7/library-autoconfigure/build.gradle.kts
@@ -19,6 +19,4 @@ tasks.withType<Test>().configureEach {
jvmArgs("--add-opens=java.base/java.math=ALL-UNNAMED")
// required on jdk17
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
-
- systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
}

MODIFY
instrumentation/apache-dubbo-2.7/library-autoconfigure/src/test/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboTraceChainTest.groovy
instrumentation/apache-dubbo-2.7/library-autoconfigure/src/test/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboTraceChainTest.groovy
package io.opentelemetry.instrumentation.apachedubbo.v2_7
import io.opentelemetry.instrumentation.test.LibraryTestTrait
-import spock.lang.IgnoreIf
-// TODO (trask) fix the test on latest version of dubbo
-@IgnoreIf({ Boolean.getBoolean("testLatestDeps") })
class DubboTraceChainTest extends AbstractDubboTraceChainTest implements LibraryTestTrait {
}

MODIFY
instrumentation/apache-dubbo-2.7/testing/src/main/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.groovy
instrumentation/apache-dubbo-2.7/testing/src/main/groovy/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboTraceChainTest.groovy
@@ -59,12 +59,12 @@ abstract class AbstractDubboTraceChainTest extends InstrumentationSpecification
return service
}
- ServiceConfig configureMiddleServer(GenericService genericService) {
+ ServiceConfig configureMiddleServer(ReferenceConfig<HelloService> referenceConfig) {
def registerConfig = new RegistryConfig()
registerConfig.setAddress("N/A")
ServiceConfig<MiddleServiceImpl> service = new ServiceConfig<>()
service.setInterface(MiddleService)
- service.setRef(new MiddleServiceImpl(genericService))
+ service.setRef(new MiddleServiceImpl(referenceConfig))
service.setRegistry(registerConfig)
return service
}
@@ -89,7 +89,7 @@ abstract class AbstractDubboTraceChainTest extends InstrumentationSpecification
DubboBootstrap middleBootstrap = DubboBootstrap.newInstance()
middleBootstrap.application(new ApplicationConfig("dubbo-demo-middle"))
.reference(reference)
- .service(configureMiddleServer(reference.get()))
+ .service(configureMiddleServer(reference))
.protocol(middleProtocolConfig)
.start()
@@ -154,6 +154,9 @@ abstract class AbstractDubboTraceChainTest extends InstrumentationSpecification
"$SemanticAttributes.RPC_METHOD" "\$invoke"
"$SemanticAttributes.NET_PEER_NAME" "localhost"
"$SemanticAttributes.NET_PEER_PORT" Long
+ "net.sock.peer.addr" { it == null || String }
+ "net.sock.peer.port" { it == null || Long }
+ "net.sock.peer.name" { it == null || String }
}
}
span(4) {

MODIFY
instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/impl/MiddleServiceImpl.java
instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/impl/MiddleServiceImpl.java
package io.opentelemetry.instrumentation.apachedubbo.v2_7.impl;
import io.opentelemetry.instrumentation.apachedubbo.v2_7.api.MiddleService;
+import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.rpc.service.GenericService;
public class MiddleServiceImpl implements MiddleService {
- private final GenericService genericService;
+ private final ReferenceConfig<?> referenceConfig;
- public MiddleServiceImpl(GenericService genericService) {
- this.genericService = genericService;
+ public MiddleServiceImpl(ReferenceConfig<?> referenceConfig) {
+ this.referenceConfig = referenceConfig;
}
@Override
public String hello(String hello) {
+ GenericService genericService = (GenericService) referenceConfig.get();
return genericService
.$invoke("hello", new String[] {String.class.getName()}, new Object[] {hello})
.toString();

Fix testLatestDeps in dubbo instrumentation (#6754)

Co-authored-by: Mateusz Rzeszutek <mrzeszutek@splunk.com>