diff --git a/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt b/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt index 394f4c9a4bd9cc690d874f501550c66e792ac7e5..68e5abc6bf269b936d2d89d7a29fdc8d0508b33c 100644 --- a/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt +++ b/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt @@ -27,19 +27,25 @@ class SloCheckerFactory { ): SloChecker { return when (sloType) { "lag trend" -> ExternalSloChecker( - externalSlopeURL = properties["externalSloUrl"] ?: throw IllegalArgumentException("externalSloUrl expected"), + externalSlopeURL = properties["externalSloUrl"] + ?: throw IllegalArgumentException("externalSloUrl expected"), threshold = properties["threshold"]?.toInt() ?: throw IllegalArgumentException("threshold expected"), warmup = properties["warmup"]?.toInt() ?: throw IllegalArgumentException("warmup expected") ) "lag trend percent" -> { - var thresholdPercent = properties["percent"]?.toInt() ?: throw IllegalArgumentException("percent for threshold expected") + if (!properties["loadType"].equals("NumSensors")) { + throw IllegalArgumentException("Percent Threshold is only allowed with load type NumSensors") + } + var thresholdPercent = + properties["percent"]?.toInt() ?: throw IllegalArgumentException("percent for threshold expected") if (thresholdPercent < 0 || thresholdPercent > 100) { throw IllegalArgumentException("Threshold percent need to be an Int in the range between 0 and 100 (inclusive)") } var threshold = (load.get() / 100.0 * thresholdPercent).toInt() ExternalSloChecker( - externalSlopeURL = properties["externalSloUrl"] ?: throw IllegalArgumentException("externalSloUrl expected"), + externalSlopeURL = properties["externalSloUrl"] + ?: throw IllegalArgumentException("externalSloUrl expected"), threshold = threshold, warmup = properties["warmup"]?.toInt() ?: throw IllegalArgumentException("warmup expected") ) diff --git a/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt b/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt index f5054dc2d8c3525562118b559ab8987215dc4ea1..bc9371763c30e4cef913a368b64e9989e7f2286b 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt @@ -55,6 +55,9 @@ class TheodoliteExecutor( this.kubernetesBenchmark.loadTypes ) + // Add load type to check if the percentage lag trend is applicable + config.slos.forEach { it.properties["loadType"] = config.load.loadType } + executor = BenchmarkExecutorImpl( benchmark = kubernetesBenchmark,