Skip to content

Commit

Permalink
Reduce load and system stress by polling less with awatility
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobat authored and alesj committed Feb 3, 2025
1 parent fbe4e52 commit efa9317
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ quarkus.log.category."io.quarkus.observability".level=DEBUG
quarkus.log.category."io.quarkus.devservices".level=DEBUG

quarkus.micrometer.binder-enabled-default=false

quarkus.http.access-log.enabled=true
quarkus.http.access-log.pattern=%h %l %u %t "%r" %s %b %m "%{i,Referer}" "%{i,User-Agent}" "%{i,X-Request-Id}" "%{i,X-Organization-Id}" %D
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public void testPoke() {
String response = RestAssured.get("/api/poke?f=100").body().asString();
log.info("Response: " + response);
GrafanaClient client = new GrafanaClient(endpoint, "admin", "admin");

Awaitility.setDefaultPollInterval(1, TimeUnit.SECONDS); // reduce load on the server. Default is .1s

Awaitility.await().atMost(61, TimeUnit.SECONDS).until(
client::user,
u -> "admin".equals(u.login));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ protected void poke(String path) {
String response = RestAssured.get(path + "/poke?f=100").body().asString();
log.info("Response: " + response);
GrafanaClient client = new GrafanaClient(grafanaEndpoint(), "admin", "admin");

Awaitility.setDefaultPollInterval(1, TimeUnit.SECONDS); // reduce load on the server. Default is .1s

Awaitility.await().atMost(61, TimeUnit.SECONDS).until(
client::user,
u -> "admin".equals(u.login));
Expand All @@ -28,5 +31,4 @@ protected void poke(String path) {
() -> client.traces("quarkus-integration-test-observability-lgtm", 20, 3),
result -> !result.traces.isEmpty());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public User user() {
throw new UncheckedIOException(e);
}
});
System.out.println("User: " + ref.get());
return ref.get();
}

Expand All @@ -104,6 +105,7 @@ public QueryResult query(String query) {
throw new UncheckedIOException(e);
}
});
System.out.println("Query: " + ref.get());
return ref.get();
}

Expand All @@ -123,6 +125,7 @@ public TempoResult traces(String service, int limit, int spss) {
throw new UncheckedIOException(e);
}
});
System.out.println("Traces: " + ref.get());
return ref.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ public class User {
public String email;
@JsonProperty
public String login;

@Override
public String toString() {
return "User{" +
"id=" + id +
", email='" + email + '\'' +
", login='" + login + '\'' +
'}';
}
}

0 comments on commit efa9317

Please sign in to comment.