Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bd4f30f

Browse files
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‎

Lines changed: 1 addition & 0 deletions
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‎

Lines changed: 14 additions & 9 deletions
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 staticio.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)

AltStyle によって変換されたページ (->オリジナル) /