Skip to content

Commit bd4f30f

Browse files
committed
chore: testing
1 parent fb2b898 commit bd4f30f

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ repositories {
1616
dependencies {
1717
implementation("io.dropwizard.metrics:metrics-core:4.2.19")
1818
implementation("io.micronaut:micronaut-management:3.9.4")
19+
implementation("io.projectreactor:reactor-core:3.4.16")
1920

2021
//attaches Source++ probe to the application
2122
javaagent("plus.sourceplus.probe:probe-jvm:0.7.9-SNAPSHOT")

src/main/java/spp/demo/command/ViewTraces.java

+14-9
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
import io.micronaut.http.annotation.Controller;
55
import io.micronaut.http.annotation.Get;
66
import io.micronaut.http.client.HttpClient;
7+
import io.micronaut.http.client.annotation.Client;
8+
import org.reactivestreams.Publisher;
9+
import reactor.core.publisher.Mono;
710

8-
import java.net.URL;
11+
import static io.micronaut.http.HttpRequest.GET;
912

1013
/**
1114
* This class is used to demonstrate the `View Traces` command.
@@ -21,22 +24,24 @@
2124
@Controller("/command")
2225
public class ViewTraces {
2326

27+
private final HttpClient httpClient;
28+
29+
public ViewTraces(@Client("/") HttpClient httpClient) {
30+
this.httpClient = httpClient;
31+
}
32+
2433
/**
2534
* Execute the `View Traces` command with your caret anywhere between lines 31 and 38 to see the traces for
2635
* the endpoint below. Executing this command will open a list of traces for the given endpoint. Clicking on a
2736
* trace will open the trace details.
2837
*/
2938
@Get("/view-traces")
30-
public HttpResponse<Void> entryEndpoint() throws Exception {
31-
try (HttpClient client = HttpClient.create(new URL("http://localhost:8080"))) {
32-
return client.toBlocking().exchange("/command/view-traces/exit");
33-
} catch (Exception e) {
34-
return HttpResponse.serverError();
35-
}
39+
public Publisher<String> entryEndpoint() {
40+
return Mono.from(httpClient.retrieve(GET("/command/view-traces/exit")));
3641
}
3742

3843
@Get("/view-traces/exit")
39-
public HttpResponse<Void> exitEndpoint() {
40-
return HttpResponse.ok();
44+
public HttpResponse<String> exitEndpoint() {
45+
return HttpResponse.ok("Success");
4146
}
4247
}

0 commit comments

Comments
 (0)