/** * Calculates the lifetime duration for the canary analysis execution. * * @param start The calculated start time for the execution * @param endTime The calculated endtime * @param canaryAnalysisExecutionRequest The execution request * @return The calculated duration of the canary analysis */ protected Duration calculateLifetime(Instant start, Instant endTime, CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest) { Duration lifetime; if (endTime != null) { lifetime = Duration.ofMinutes(start.until(endTime, MINUTES)); } else if (canaryAnalysisExecutionRequest.getLifetimeDuration() != null) { lifetime = canaryAnalysisExecutionRequest.getLifetimeDuration(); } else { throw new IllegalArgumentException("Canary stage configuration must include either `endTime` or `lifetimeDuration`."); } return lifetime; }
/** * Calculates the lifetime duration for the canary analysis execution. * * @param start The calculated start time for the execution * @param endTime The calculated endtime * @param canaryAnalysisExecutionRequest The execution request * @return The calculated duration of the canary analysis */ protected Duration calculateLifetime(Instant start, Instant endTime, CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest) { Duration lifetime; if (endTime != null) { lifetime = Duration.ofMinutes(start.until(endTime, MINUTES)); } else if (canaryAnalysisExecutionRequest.getLifetimeDuration() != null) { lifetime = canaryAnalysisExecutionRequest.getLifetimeDuration(); } else { throw new IllegalArgumentException("Canary stage configuration must include either `endTime` or `lifetimeDuration`."); } return lifetime; }