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

use decimal notation for percentage value of lag trend

parent 6f663e0c
No related branches found
No related tags found
1 merge request!172Use the properties of the slo checker and add lag trend percent
...@@ -37,11 +37,13 @@ class SloCheckerFactory { ...@@ -37,11 +37,13 @@ class SloCheckerFactory {
throw IllegalArgumentException("Percent Threshold is only allowed with load type NumSensors") throw IllegalArgumentException("Percent Threshold is only allowed with load type NumSensors")
} }
var thresholdPercent = var thresholdPercent =
properties["percent"]?.toInt() ?: throw IllegalArgumentException("percent for threshold expected") properties["percent"]?.toDouble()
if (thresholdPercent < 0 || thresholdPercent > 100) { ?: throw IllegalArgumentException("percent for threshold expected")
throw IllegalArgumentException("Threshold percent need to be an Int in the range between 0 and 100 (inclusive)") 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)")
} }
var threshold = (load.get() / 100.0 * thresholdPercent).toInt() // cast to int, as rounding is not really necessary
var threshold = (load.get() * thresholdPercent).toInt()
ExternalSloChecker( ExternalSloChecker(
externalSlopeURL = properties["externalSloUrl"] externalSlopeURL = properties["externalSloUrl"]
......
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