Class HistoricalDataManager

java.lang.Object
de.cuioss.benchmarking.common.report.HistoricalDataManager

public class HistoricalDataManager extends Object
Manages historical benchmark data persistence.

This manager handles:

  • Saving current benchmark runs to history with timestamp-based naming
  • Maintaining a retention policy (keeping only the most recent runs)
  • Organizing historical data in a queryable directory structure

File naming convention: YYYY-MM-DD-THHMMZ-{commitSha}.json where the timestamp is in UTC and the commit SHA is truncated to 8 characters.

  • Constructor Details

  • Method Details

    • archiveCurrentRun

      public void archiveCurrentRun(Map<String,Object> currentData, String outputDir, String commitSha) throws IOException
      Archives the current benchmark data to the history directory.
      Parameters:
      currentData - the current benchmark data to archive
      outputDir - the base output directory
      commitSha - the Git commit SHA (will be truncated to 8 chars)
      Throws:
      IOException - if writing the archive file fails
    • enforceRetentionPolicy

      public void enforceRetentionPolicy(Path historyDir) throws IOException
      Enforces the retention policy by keeping only the most recent files.
      Parameters:
      historyDir - the history directory path
      Throws:
      IOException - if accessing or deleting files fails
    • getHistoricalFiles

      public List<Path> getHistoricalFiles(Path historyDir) throws IOException
      Retrieves a sorted list of historical data files.
      Parameters:
      historyDir - the history directory path
      Returns:
      sorted list of historical data files (newest first)
      Throws:
      IOException - if reading the directory fails
    • hasHistoricalData

      public boolean hasHistoricalData(String outputDir)
      Checks if historical data is available.
      Parameters:
      outputDir - the base output directory
      Returns:
      true if historical data exists, false otherwise