Skip to content

Commit 546afe3

Browse files
committed
cleanups
1 parent 6d6a93f commit 546afe3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

instrumentation/ratpack/ratpack-1.7/library/src/test/java/io/opentelemetry/instrumentation/ratpack/v1_7/client/BarService.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ protected void generateSpan(StartEvent event) {
3838
httpClient
3939
.get(new URI(url))
4040
.flatMap(response -> httpClient.get(new URI(url)))
41-
.then(
42-
response -> {
43-
span.end();
44-
});
41+
.then(response -> span.end());
4542
} catch (URISyntaxException e) {
4643
throw new RuntimeException(e);
4744
}

instrumentation/ratpack/ratpack-1.7/library/src/test/java/io/opentelemetry/instrumentation/ratpack/v1_7/server/RatpackServerTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import io.opentelemetry.api.trace.Span;
2222
import io.opentelemetry.api.trace.SpanKind;
2323
import io.opentelemetry.instrumentation.ratpack.v1_7.RatpackServerTelemetry;
24+
import io.opentelemetry.instrumentation.testing.internal.AutoCleanupExtension;
2425
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
2526
import io.opentelemetry.instrumentation.testing.junit.LibraryInstrumentationExtension;
2627
import org.junit.jupiter.api.BeforeAll;
@@ -34,6 +35,9 @@ class RatpackServerTest {
3435
@RegisterExtension
3536
private static final InstrumentationExtension testing = LibraryInstrumentationExtension.create();
3637

38+
@RegisterExtension
39+
private static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();
40+
3741
private static final RatpackServerTelemetry telemetry =
3842
RatpackServerTelemetry.builder(testing.getOpenTelemetry()).build();
3943

@@ -52,6 +56,7 @@ void testAddSpanOnHandlers() throws Exception {
5256
spec.registry(registry);
5357
spec.handlers(chain -> chain.get("foo", ctx -> ctx.render("hi-foo")));
5458
});
59+
cleanup.deferCleanup(app);
5560

5661
assertThat(app.getHttpClient().get("foo").getBody().getText()).isEqualTo("hi-foo");
5762

@@ -97,6 +102,7 @@ void testPropagateTraceWithInstrumentedAsyncOperations() throws Exception {
97102
.then();
98103
}));
99104
});
105+
cleanup.deferCleanup(app);
100106

101107
assertThat(app.getHttpClient().get("foo").getBody().getText()).isEqualTo("hi-foo");
102108

@@ -162,6 +168,7 @@ void testPropagateTraceWithInstrumentedAsyncConcurrentOperations() throws Except
162168
});
163169
});
164170
});
171+
cleanup.deferCleanup(app);
165172

166173
assertThat(app.getHttpClient().get("foo").getBody().getText()).isEqualTo("hi-foo");
167174
assertThat(app.getHttpClient().get("bar").getBody().getText()).isEqualTo("hi-bar");

0 commit comments

Comments
 (0)