Search in sources :

Example 1 with HdrHistogramChecker

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;
}
Also used : HdrHistogramChecker(com.datastax.fallout.components.file_artifact_checkers.HdrHistogramChecker) TestRunIdentifier(com.datastax.fallout.service.core.TestRunIdentifier) PerformanceReport(com.datastax.fallout.service.core.PerformanceReport) UUID(java.util.UUID) Date(java.util.Date)

Aggregations

HdrHistogramChecker (com.datastax.fallout.components.file_artifact_checkers.HdrHistogramChecker)1 PerformanceReport (com.datastax.fallout.service.core.PerformanceReport)1 TestRunIdentifier (com.datastax.fallout.service.core.TestRunIdentifier)1 Date (java.util.Date)1 UUID (java.util.UUID)1