Skip to content

Commit 43a33c4

Browse files
committed
Add service peer name handling to registry tests
1 parent 60dfe35 commit 43a33c4

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

instrumentation/apache-dubbo-2.7/javaagent/src/testDubbo/java/io/opentelemetry/javaagent/instrumentation/apachedubbo/v2_7/DubboAgentRegistryTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,9 @@ class DubboAgentRegistryTest extends AbstractDubboRegistryTest {
1919
protected InstrumentationExtension testing() {
2020
return testing;
2121
}
22+
23+
@Override
24+
protected boolean hasServicePeerName() {
25+
return true;
26+
}
2227
}

instrumentation/apache-dubbo-2.7/library-autoconfigure/src/test/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/DubboRegistryTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@ class DubboRegistryTest extends AbstractDubboRegistryTest {
1818
protected InstrumentationExtension testing() {
1919
return testing;
2020
}
21+
22+
@Override
23+
protected boolean hasServicePeerName() {
24+
return false;
25+
}
2126
}

instrumentation/apache-dubbo-2.7/testing/src/main/java/io/opentelemetry/instrumentation/apachedubbo/v2_7/AbstractDubboRegistryTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import static io.opentelemetry.instrumentation.api.internal.SemconvStability.emitOldRpcSemconv;
1010
import static io.opentelemetry.instrumentation.api.internal.SemconvStability.emitStableRpcSemconv;
1111
import static io.opentelemetry.instrumentation.testing.GlobalTraceUtil.runWithSpan;
12+
import static io.opentelemetry.instrumentation.testing.junit.service.SemconvServiceStabilityUtil.maybeStablePeerService;
1213
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.assertThat;
1314
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
1415
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.satisfies;
@@ -62,6 +63,8 @@ public abstract class AbstractDubboRegistryTest {
6263

6364
protected abstract InstrumentationExtension testing();
6465

66+
protected abstract boolean hasServicePeerName();
67+
6568
@BeforeAll
6669
static void setUp() throws Exception {
6770
zkServer = new TestingServer();
@@ -207,6 +210,9 @@ void testRegistryModeServerAddress() throws ReflectiveOperationException {
207210
emitStableRpcSemconv()
208211
? "io.opentelemetry.instrumentation.apachedubbo.v2_7.api.HelloService/hello"
209212
: "hello"),
213+
equalTo(
214+
maybeStablePeerService(),
215+
hasServicePeerName() ? "test-peer-service" : null),
210216
satisfies(
211217
NETWORK_PEER_ADDRESS, val -> val.isInstanceOf(String.class)),
212218
satisfies(

0 commit comments

Comments
 (0)