Skip to content

Commit df431c4

Browse files
committed
add tests on default inbox monitoring
1 parent 0a89c79 commit df431c4

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

instrumentation/nats/nats-2.17/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/nats/v2_17/NatsInstrumentationRequestTest.java

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

instrumentation/nats/nats-2.17/library/src/test/java/io/opentelemetry/instrumentation/nats/v2_17/NatsInstrumentationRequestTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55

66
package io.opentelemetry.instrumentation.nats.v2_17;
77

8+
import io.nats.client.Nats;
9+
import io.nats.client.Options;
810
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
911
import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension;
12+
import java.io.IOException;
1013
import org.junit.jupiter.api.BeforeAll;
1114
import org.junit.jupiter.api.extension.RegisterExtension;
1215

@@ -21,15 +24,11 @@ protected InstrumentationExtension testing() {
2124
}
2225

2326
@BeforeAll
24-
static void beforeAll() {
25-
connection = NatsTelemetry.create(testing.getOpenTelemetry()).wrap(connection);
26-
}
27-
28-
@Override
29-
protected boolean isInboxMonitored() {
30-
// in the library instrumentation, as we're proxying Connection,
31-
// we can not properly instrument the Dispatcher and the MessageHandler
32-
// created for every `request` on the _INBOX.* subjects
33-
return false;
27+
static void beforeAll() throws IOException, InterruptedException {
28+
NatsTelemetry telemetry = NatsTelemetry.create(testing.getOpenTelemetry());
29+
connection =
30+
telemetry.wrap(
31+
Nats.connect(
32+
telemetry.wrap(Options.builder().server(connection.getConnectedUrl())).build()));
3433
}
3534
}

instrumentation/nats/nats-2.17/testing/src/main/java/io/opentelemetry/instrumentation/nats/v2_17/AbstractNatsInstrumentationRequestTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
public abstract class AbstractNatsInstrumentationRequestTest
3030
extends AbstractNatsInstrumentationTest {
3131

32-
protected abstract boolean isInboxMonitored();
33-
3432
private int clientId;
3533
private Subscription subscription;
3634

@@ -307,10 +305,6 @@ private void assertPublishReceiveSpansSameTrace() {
307305
.hasAttributesSatisfyingExactly(
308306
messagingAttributes("process", "_INBOX.", clientId))));
309307

310-
if (!isInboxMonitored()) {
311-
asserts.remove(asserts.size() - 1);
312-
}
313-
314308
trace.hasSpansSatisfyingExactly(asserts);
315309
});
316310
}

0 commit comments

Comments
 (0)