Class BuildHistoryImporter
java.lang.Object
io.jenkins.plugins.dorametrics.collectors.BuildHistoryImporter
Imports builds that are already on disk, for instances where the plugin was installed
after the builds ran, or where a job did not match the filters at the time.
Each build is handed to BuildRecorder.record(Run), the same entry point the
listener uses, so imported builds get the same filter, commit and stage handling as
builds recorded as they complete.
Only one import runs at a time. A second caller is told the import is already running rather than being allowed to double the work.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classCounters for one import run. -
Method Summary
Modifier and TypeMethodDescriptionstatic BuildHistoryImporter.ResultA snapshot of the run in progress, or of the last one to finish, or null if none has ever run.static BuildHistoryImporter.ResultimportHistory(int days) Imports every build newer thandaysdays that is not already stored, on the calling thread.static booleanTrue while an import is running.static intresolveDays(DoraGlobalConfiguration config) The import window, capped at the retention window so it cannot import rows cleanup would drop.static booleanstartAsync(int days) Starts an import on Jenkins' executor and returns at once.
-
Method Details
-
isRunning
public static boolean isRunning()True while an import is running. -
getLastResult
A snapshot of the run in progress, or of the last one to finish, or null if none has ever run. Reading it while an import is going returns the counts so far rather than the previous run's totals. -
importHistory
Imports every build newer thandaysdays that is not already stored, on the calling thread.- Returns:
- the counters, or null if an import was already running
-
startAsync
public static boolean startAsync(int days) Starts an import on Jenkins' executor and returns at once.The slot is taken before this returns, not when the submitted task begins, so a caller that polls
isRunning()immediately afterwards sees the import in progress rather than the counters of the previous one.- Returns:
- false if an import was already running, in which case nothing was started
-
resolveDays
The import window, capped at the retention window so it cannot import rows cleanup would drop.
-