From 29cfc7dd22c2e890b4d9ed782904dde333271cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Vonheiden?= <bjoern.vonheiden@hotmail.de> Date: Wed, 13 Oct 2021 11:38:35 +0200 Subject: [PATCH] use lag trend ratio instead of percent --- .../evaluation/SloCheckerFactory.kt | 23 ++++++++----------- .../execution/TheodoliteExecutor.kt | 3 --- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt b/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt index 76b158a58..93e8e6180 100644 --- a/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt +++ b/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt @@ -22,13 +22,13 @@ class SloCheckerFactory { * - `warmup`: time from the beginning to skip in the analysis. * * - * ### `lag trend percent` + * ### `lag trend ratio` * Creates an [ExternalSloChecker] with defined parameters. - * The required threshold is computed using a percentage and the load of the experiment. + * The required threshold is computed using a ratio and the load of the experiment. * * The properties map needs the following fields: * - `externalSlopeURL`: Url to the concrete SLO checker service. - * - `percent`: of the executed load that is accepted for the slope. + * - `ratio`: of the executed load that is accepted for the slope. * - `warmup`: time from the beginning to skip in the analysis. * * @param sloType Type of the [SloChecker]. @@ -50,18 +50,15 @@ class SloCheckerFactory { threshold = properties["threshold"]?.toInt() ?: throw IllegalArgumentException("threshold expected"), warmup = properties["warmup"]?.toInt() ?: throw IllegalArgumentException("warmup expected") ) - "lag trend percent" -> { - if (!properties["loadType"].equals("NumSensors")) { - throw IllegalArgumentException("Percent Threshold is only allowed with load type NumSensors") - } - var thresholdPercent = - properties["percent"]?.toDouble() - ?: throw IllegalArgumentException("percent for threshold expected") - if (thresholdPercent < 0.0 || thresholdPercent > 1.0) { - throw IllegalArgumentException("Threshold percent need to be an Double in the range between 0.0 and 1.0 (inclusive)") + "lag trend ratio" -> { + var thresholdRatio = + properties["ratio"]?.toDouble() + ?: throw IllegalArgumentException("ratio for threshold expected") + if (thresholdRatio < 0.0) { + throw IllegalArgumentException("Threshold ratio needs to be an Double greater or equal 0.0") } // cast to int, as rounding is not really necessary - var threshold = (load.get() * thresholdPercent).toInt() + var threshold = (load.get() * thresholdRatio).toInt() ExternalSloChecker( externalSlopeURL = properties["externalSloUrl"] diff --git a/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt b/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt index bc9371763..f5054dc2d 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/TheodoliteExecutor.kt @@ -55,9 +55,6 @@ 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, -- GitLab