Class OutputDirectoryStructure

java.lang.Object
de.cuioss.benchmarking.common.output.OutputDirectoryStructure

public class OutputDirectoryStructure extends Object
Manages the output directory structure for benchmark results. Provides clear separation between deployable content (gh-pages-ready) and non-deployable raw data (history, prometheus, wrk).

Directory structure:

 benchmark-results/
 ├── gh-pages-ready/         (deploymentDir, htmlDir) - All content deployable to GitHub Pages
 │   ├── data/               (dataDir) - JSON data files
 │   ├── badges/             (badgesDir) - Badge JSON files
 │   └── api/                (apiDir) - API endpoint JSON files
 ├── history/                (historyDir) - Historical archive data (NOT deployed)
 ├── prometheus/             (prometheusRawDir) - Raw Prometheus metrics (NOT deployed)
 └── wrk/                    (wrkDir) - WRK raw results (NOT deployed)
 
  • Constructor Details

    • OutputDirectoryStructure

      public OutputDirectoryStructure(Path benchmarkResultsDir)
      Creates a new output directory structure.
      Parameters:
      benchmarkResultsDir - the root benchmark-results directory
      Throws:
      NullPointerException - if benchmarkResultsDir is null
  • Method Details

    • ensureDirectories

      public void ensureDirectories() throws IOException
      Ensures deployment directories exist, creating them if necessary. Non-deployed directories (history, prometheus, wrk) are created only when accessed.
      Throws:
      IOException - if directory creation fails
    • getHistoryDir

      public Path getHistoryDir() throws IOException
      Gets the history directory (benchmark-results/history). Historical archive data should be stored in this directory. This directory is NOT deployed to GitHub Pages. Creates the directory if it doesn't exist.
      Returns:
      the history directory path
      Throws:
      IOException - if directory creation fails
    • getPrometheusRawDir

      Gets the raw Prometheus metrics directory (benchmark-results/prometheus). Raw Prometheus data should be stored in this directory. This directory is NOT deployed to GitHub Pages. Creates the directory if it doesn't exist.
      Returns:
      the raw Prometheus directory path
      Throws:
      IOException - if directory creation fails
    • getWrkDir

      public Path getWrkDir() throws IOException
      Gets the WRK directory (benchmark-results/wrk). WRK raw results should be stored in this directory. This directory is NOT deployed to GitHub Pages. Creates the directory if it doesn't exist.
      Returns:
      the WRK directory path
      Throws:
      IOException - if directory creation fails
    • isDeploymentDirectoryExists

      public boolean isDeploymentDirectoryExists()
      Checks if the deployment directory exists.
      Returns:
      true if the deployment directory exists, false otherwise
    • cleanDeploymentDirectory

      public void cleanDeploymentDirectory() throws IOException
      Cleans the deployment directory by deleting it and recreating it. This ensures a fresh start for report generation.
      Throws:
      IOException - if deletion or creation fails
    • toString

      public String toString()
      Overrides:
      toString in class Object