Skip to content
Snippets Groups Projects
Commit 90492233 authored by Björn Vonheiden's avatar Björn Vonheiden
Browse files

Enable check of load type for percentage lag trend

The percentage lag trend is at the moment only available for the NumSensors
load type, because for NumNestedGroups it makes no sense.
parent cd70579e
No related branches found
No related tags found
1 merge request!172Use the properties of the slo checker and add lag trend percent
...@@ -27,19 +27,25 @@ class SloCheckerFactory { ...@@ -27,19 +27,25 @@ class SloCheckerFactory {
): SloChecker { ): SloChecker {
return when (sloType) { return when (sloType) {
"lag trend" -> ExternalSloChecker( "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"), threshold = properties["threshold"]?.toInt() ?: throw IllegalArgumentException("threshold expected"),
warmup = properties["warmup"]?.toInt() ?: throw IllegalArgumentException("warmup expected") warmup = properties["warmup"]?.toInt() ?: throw IllegalArgumentException("warmup expected")
) )
"lag trend percent" -> { "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) { if (thresholdPercent < 0 || thresholdPercent > 100) {
throw IllegalArgumentException("Threshold percent need to be an Int in the range between 0 and 100 (inclusive)") 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() var threshold = (load.get() / 100.0 * thresholdPercent).toInt()
ExternalSloChecker( ExternalSloChecker(
externalSlopeURL = properties["externalSloUrl"] ?: throw IllegalArgumentException("externalSloUrl expected"), externalSlopeURL = properties["externalSloUrl"]
?: throw IllegalArgumentException("externalSloUrl expected"),
threshold = threshold, threshold = threshold,
warmup = properties["warmup"]?.toInt() ?: throw IllegalArgumentException("warmup expected") warmup = properties["warmup"]?.toInt() ?: throw IllegalArgumentException("warmup expected")
) )
......
...@@ -55,6 +55,9 @@ class TheodoliteExecutor( ...@@ -55,6 +55,9 @@ class TheodoliteExecutor(
this.kubernetesBenchmark.loadTypes 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 = executor =
BenchmarkExecutorImpl( BenchmarkExecutorImpl(
benchmark = kubernetesBenchmark, benchmark = kubernetesBenchmark,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment