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 ...@@ -6,7 +6,7 @@ import java.net.ConnectException
import java.time.Duration import java.time.Duration
import java.time.Instant import java.time.Instant
class ExternalSLOChecker( class ExternalSloChecker(
private val prometheusURL: String, private val prometheusURL: String,
private val query: String, private val query: String,
private val externalSlopeURL: 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 ...@@ -3,7 +3,7 @@ package theodolite.execution
import mu.KotlinLogging import mu.KotlinLogging
import theodolite.benchmark.Benchmark import theodolite.benchmark.Benchmark
import theodolite.benchmark.BenchmarkExecution import theodolite.benchmark.BenchmarkExecution
import theodolite.evaluation.ExternalSLOChecker import theodolite.evaluation.SloCheckerFactory
import theodolite.util.ConfigurationOverride import theodolite.util.ConfigurationOverride
import theodolite.util.LoadDimension import theodolite.util.LoadDimension
import theodolite.util.Resource import theodolite.util.Resource
...@@ -26,17 +26,17 @@ class BenchmarkExecutorImpl( ...@@ -26,17 +26,17 @@ class BenchmarkExecutorImpl(
benchmarkDeployment.setup() benchmarkDeployment.setup()
this.waitAndLog() this.waitAndLog()
benchmarkDeployment.teardown() benchmarkDeployment.teardown()
// todo evaluate
var result = false var result = false
try { try {
result = ExternalSLOChecker( result = SloCheckerFactory().create(
slo.prometheusUrl, slotype = slo.sloType,
"sum by(group)(kafka_consumergroup_group_lag >= 0)", prometheusURL = slo.prometheusUrl,
slo.externalSloUrl, query = "sum by(group)(kafka_consumergroup_group_lag >= 0)",
slo.threshold, externalSlopeURL = slo.externalSloUrl,
Duration.ofHours(slo.offset.toLong()), threshold = slo.threshold,
slo.warmup offset = Duration.ofHours(slo.offset.toLong()),
warmup = slo.warmup
) )
.evaluate( .evaluate(
Instant.now().minus(executionDuration), Instant.now().minus(executionDuration),
......
...@@ -9,7 +9,7 @@ resources: ...@@ -9,7 +9,7 @@ resources:
resourceValues: resourceValues:
- 1 - 1
slos: slos:
- sloType: "slo type" - sloType: "lag trend"
threshold: 1000 threshold: 1000
prometheusUrl: "http://localhost:32656" prometheusUrl: "http://localhost:32656"
externalSloUrl: "http://localhost:80/evaluate-slope" 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