diff --git a/.env b/.env index 631fdebf..b3af116c 100644 --- a/.env +++ b/.env @@ -6,4 +6,4 @@ WARP_CORE_INFLUX_PORT=8086 # Versions MYSQL_VERSION=8.0.30 INFLUX_VERSION=1.5.2 -GRAFANA_VERSION=5.0.2 +GRAFANA_VERSION=8.2.6 diff --git a/warp-core/src/main/scala/com/workday/warp/arbiters/ResponseTimeArbiter.scala b/warp-core/src/main/scala/com/workday/warp/arbiters/ResponseTimeArbiter.scala index bde5cb0d..9ef0b08e 100644 --- a/warp-core/src/main/scala/com/workday/warp/arbiters/ResponseTimeArbiter.scala +++ b/warp-core/src/main/scala/com/workday/warp/arbiters/ResponseTimeArbiter.scala @@ -29,9 +29,9 @@ class ResponseTimeArbiter extends ArbiterLike with CorePersistenceAware { */ override def vote[T: TestExecutionRowLikeType](ballot: Ballot, testExecution: T): Option[Throwable] = { val testId: String = this.persistenceUtils.getMethodSignature(testExecution) - val threshold: Duration = testExecution.responseTimeRequirement.seconds + val threshold: Duration = this.getThreshold(testExecution) - val responseTime: Duration = Duration.ofNanos(TimeUtils.toNanos(testExecution.responseTime, TimeUnit.SECONDS)) + val responseTime: Duration = this.getResponseTime(testExecution) if (threshold.isPositive && responseTime > threshold) { Option(new RequirementViolationException( @@ -43,4 +43,27 @@ class ResponseTimeArbiter extends ArbiterLike with CorePersistenceAware { None } } + + + /** + * Gets response time from the test execution. Subclasses may have a different notion of where to obtain response time. + * + * @param testExecution [[TestExecutionRowLikeType]] we are voting on. + * @return test response time as a [[Duration]]. + */ + def getResponseTime[T: TestExecutionRowLikeType](testExecution: T): Duration = { + TimeUtils.toNanos(testExecution.responseTime, TimeUnit.SECONDS).nanoseconds + } + + + /** + * Gets test response time threshold from the test execution. Subclasses may have a different notion of where to obtain + * a threshold. For example, [[SpikeFilterSettings]]. + * + * @param testExecution [[TestExecutionRowLikeType]] we are voting on. + * @return test response time threshold as a [[Duration]]. + */ + def getThreshold[T: TestExecutionRowLikeType](testExecution: T): Duration = { + testExecution.responseTimeRequirement.seconds + } }