Skip to content
Snippets Groups Projects
Commit ac95105d authored by Lorenz Boguhn's avatar Lorenz Boguhn Committed by Lorenz Boguhn
Browse files

Add slo Factory

parent 77a09cee
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!92Introduce experiment evaluation,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
......@@ -6,7 +6,7 @@ import java.net.ConnectException
import java.time.Duration
import java.time.Instant
class ExternalSLOChecker(
class ExternalSloChecker(
private val prometheusURL: String,
private val query: String,
private val externalSlopeURL: String,
......
package theodolite.evaluation
import java.time.Duration
class SloCheckerFactory {
fun create(
slotype: String,
prometheusURL: String,
query: String,
externalSlopeURL: String,
threshold: Int,
offset: Duration,
warmup: Int
): SloChecker {
return when (slotype) {
"lag trend" -> ExternalSloChecker(
prometheusURL = prometheusURL,
query = query,
externalSlopeURL = externalSlopeURL,
threshold = threshold,
offset = offset,
warmup = warmup
)
else -> throw IllegalArgumentException("Slotype $slotype not found.")
}
}
}
......@@ -3,7 +3,7 @@ package theodolite.execution
import mu.KotlinLogging
import theodolite.benchmark.Benchmark
import theodolite.benchmark.BenchmarkExecution
import theodolite.evaluation.ExternalSLOChecker
import theodolite.evaluation.SloCheckerFactory
import theodolite.util.ConfigurationOverride
import theodolite.util.LoadDimension
import theodolite.util.Resource
......@@ -26,17 +26,17 @@ class BenchmarkExecutorImpl(
benchmarkDeployment.setup()
this.waitAndLog()
benchmarkDeployment.teardown()
// todo evaluate
var result = false
try {
result = ExternalSLOChecker(
slo.prometheusUrl,
"sum by(group)(kafka_consumergroup_group_lag >= 0)",
slo.externalSloUrl,
slo.threshold,
Duration.ofHours(slo.offset.toLong()),
slo.warmup
result = SloCheckerFactory().create(
slotype = slo.sloType,
prometheusURL = slo.prometheusUrl,
query = "sum by(group)(kafka_consumergroup_group_lag >= 0)",
externalSlopeURL = slo.externalSloUrl,
threshold = slo.threshold,
offset = Duration.ofHours(slo.offset.toLong()),
warmup = slo.warmup
)
.evaluate(
Instant.now().minus(executionDuration),
......
......@@ -9,7 +9,7 @@ resources:
resourceValues:
- 1
slos:
- sloType: "slo type"
- sloType: "lag trend"
threshold: 1000
prometheusUrl: "http://localhost:32656"
externalSloUrl: "http://localhost:80/evaluate-slope"
......
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