Fix ClassCastException in overhead tests (#6019)
This commit is contained in:
parent
6a0ca530b7
commit
3611f11e39
|
@ -63,10 +63,10 @@ public class ResultsCollector {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Path k6File = namingConvention.k6Results(agent);
|
Path k6File = namingConvention.k6Results(agent);
|
||||||
String json = new String(Files.readAllBytes(k6File));
|
String json = new String(Files.readAllBytes(k6File));
|
||||||
double iterationAvg = JsonPath.read(json, "$.metrics.iteration_duration.avg");
|
double iterationAvg = read(json, "$.metrics.iteration_duration.avg");
|
||||||
double iterationP95 = JsonPath.read(json, "$.metrics.iteration_duration['p(95)']");
|
double iterationP95 = read(json, "$.metrics.iteration_duration['p(95)']");
|
||||||
double requestAvg = JsonPath.read(json, "$.metrics.http_req_duration.avg");
|
double requestAvg = read(json, "$.metrics.http_req_duration.avg");
|
||||||
double requestP95 = JsonPath.read(json, "$.metrics.http_req_duration['p(95)']");
|
double requestP95 = read(json, "$.metrics.http_req_duration['p(95)']");
|
||||||
return builder
|
return builder
|
||||||
.iterationAvg(iterationAvg)
|
.iterationAvg(iterationAvg)
|
||||||
.iterationP95(iterationP95)
|
.iterationP95(iterationP95)
|
||||||
|
@ -74,6 +74,12 @@ public class ResultsCollector {
|
||||||
.requestP95(requestP95);
|
.requestP95(requestP95);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static double read(String json, String jsonPath) {
|
||||||
|
// JsonPath.read returns either Double or BigDecimal
|
||||||
|
Number result = JsonPath.read(json, jsonPath);
|
||||||
|
return result.doubleValue();
|
||||||
|
}
|
||||||
|
|
||||||
private AppPerfResults.Builder addJfrResults(AppPerfResults.Builder builder, Agent agent)
|
private AppPerfResults.Builder addJfrResults(AppPerfResults.Builder builder, Agent agent)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Path jfrFile = namingConvention.jfrFile(agent);
|
Path jfrFile = namingConvention.jfrFile(agent);
|
||||||
|
|
Loading…
Reference in New Issue