use of com.datastax.fallout.components.file_artifact_checkers.HdrHistogramChecker in project fallout by datastax.
the class PerformanceToolResource method createPerformanceReport.
private PerformanceReport createPerformanceReport(List<TestRun> testRuns, String userEmail, String reportName) throws Exception {
HdrHistogramChecker checker = new HdrHistogramChecker();
UUID reportGuid = UUID.randomUUID();
Set<TestRunIdentifier> testRunIdentifiers = testRuns.stream().map(ReadOnlyTestRun::getTestRunIdentifier).collect(Collectors.toSet());
if (testRuns.size() != testRunIdentifiers.size()) {
throw new RuntimeException("Test Runs submitted for report contains duplicates");
}
String fullReportName = Paths.get("performance_reports", userEmail, reportGuid.toString(), "report").toString();
java.nio.file.Path scratchDir = Files.createTempDirectory(String.format("performance-tool-report-%s", reportName));
try {
checker.compareTests(testRuns, rootArtifactPath, fullReportName, reportName, scratchDir);
} finally {
FileUtils.deleteDir(scratchDir);
}
PerformanceReport report = new PerformanceReport();
report.setEmail(userEmail);
report.setReportName(reportName);
report.setReportArtifact(fullReportName + ".html");
report.setReportTestRuns(testRunIdentifiers);
report.setReportDate(new Date());
report.setReportGuid(reportGuid);
reportDAO.add(report);
return report;
}
Aggregations