Skip to content
Snippets Groups Projects

Use lag trend ratio instead of percent

Merged Björn Vonheiden requested to merge stu202077/theodolite:ratioSLOChecker into master
2 files
+ 10
16
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -22,13 +22,13 @@ class SloCheckerFactory {
@@ -22,13 +22,13 @@ class SloCheckerFactory {
* - `warmup`: time from the beginning to skip in the analysis.
* - `warmup`: time from the beginning to skip in the analysis.
*
*
*
*
* ### `lag trend percent`
* ### `lag trend ratio`
* Creates an [ExternalSloChecker] with defined parameters.
* 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:
* The properties map needs the following fields:
* - `externalSlopeURL`: Url to the concrete SLO checker service.
* - `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.
* - `warmup`: time from the beginning to skip in the analysis.
*
*
* @param sloType Type of the [SloChecker].
* @param sloType Type of the [SloChecker].
@@ -50,18 +50,15 @@ class SloCheckerFactory {
@@ -50,18 +50,15 @@ class SloCheckerFactory {
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 ratio" -> {
if (!properties["loadType"].equals("NumSensors")) {
var thresholdRatio =
throw IllegalArgumentException("Percent Threshold is only allowed with load type NumSensors")
properties["ratio"]?.toDouble()
}
?: throw IllegalArgumentException("ratio for threshold expected")
var thresholdPercent =
if (thresholdRatio < 0.0) {
properties["percent"]?.toDouble()
throw IllegalArgumentException("Threshold ratio needs to be an Double greater or equal 0.0")
?: 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)")
}
}
// cast to int, as rounding is not really necessary
// cast to int, as rounding is not really necessary
var threshold = (load.get() * thresholdPercent).toInt()
var threshold = (load.get() * thresholdRatio).toInt()
ExternalSloChecker(
ExternalSloChecker(
externalSlopeURL = properties["externalSloUrl"]
externalSlopeURL = properties["externalSloUrl"]
Loading