Class HistoricalDataManager
java.lang.Object
de.cuioss.benchmarking.common.report.HistoricalDataManager
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidArchives the current benchmark data to the history directory.voidenforceRetentionPolicy(Path historyDir) Enforces the retention policy by keeping only the most recent files.getHistoricalFiles(Path historyDir) Retrieves a sorted list of historical data files.booleanhasHistoricalData(String outputDir) Checks if historical data is available.
-
Constructor Details
-
HistoricalDataManager
public HistoricalDataManager()
-
-
Method Details
-
archiveCurrentRun
public void archiveCurrentRun(Map<String, Object> currentData, String outputDir, String commitSha) throws IOExceptionArchives the current benchmark data to the history directory.- Parameters:
currentData- the current benchmark data to archiveoutputDir- the base output directorycommitSha- the Git commit SHA (will be truncated to 8 chars)- Throws:
IOException- if writing the archive file fails
-
enforceRetentionPolicy
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
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
Checks if historical data is available.- Parameters:
outputDir- the base output directory- Returns:
- true if historical data exists, false otherwise
-