Skip to content
Snippets Groups Projects
Commit 05296646 authored by Marcel Samir Becker's avatar Marcel Samir Becker
Browse files

Finished SLOFactory, constructing SLOs from Benchmark and Execution yaml

parent 3d000edc
No related branches found
No related tags found
1 merge request!251Move definition of SLOs to Benchmark
Showing
with 40 additions and 35 deletions
......@@ -33,6 +33,15 @@ spec:
resource: "uc1-load-generator-deployment.yaml"
properties:
loadGenMaxRecords: "150000"
slos:
- name: "lag trend"
sloType: "lag trend"
prometheusUrl: "http://prometheus-operated:9090"
offset: 0
properties:
threshold: 3000
externalSloUrl: "http://localhost:80/evaluate-slope"
warmup: 60 # in seconds
kafkaConfig:
bootstrapServer: "theodolite-kafka-kafka-bootstrap:9092"
topics:
......
......@@ -11,13 +11,9 @@ spec:
resourceType: "Instances"
resourceValues: [1, 2, 3, 4, 5]
slos:
- sloType: "lag trend"
prometheusUrl: "http://prometheus-operated:9090"
offset: 0
- name: "lag trend"
properties:
threshold: 2000
externalSloUrl: "http://localhost:80/evaluate-slope"
warmup: 60 # in seconds
execution:
strategy: "LinearSearch"
duration: 300 # in seconds
......
......@@ -30,7 +30,7 @@ class BenchmarkExecution : KubernetesResource {
lateinit var benchmark: String
lateinit var load: LoadDefinition
lateinit var resources: ResourceDefinition
lateinit var slos: List<KubernetesBenchmark.Slo>
lateinit var slos: List<Slo>
lateinit var execution: Execution
lateinit var configOverrides: MutableList<ConfigurationOverride?>
......@@ -49,25 +49,22 @@ class BenchmarkExecution : KubernetesResource {
var afterTeardownDelay = 5L
}
//TODO: use new SLO class since the values do not need to be set (just optional)
/**
* Measurable metric.
* [sloType] determines the type of the metric.
* It is evaluated using the [theodolite.evaluation.ExternalSloChecker] by data measured by Prometheus.
* The evaluation checks if a [threshold] is reached or not.
* [offset] determines the shift in hours by which the start and end timestamps should be shifted.
* The [warmup] determines after which time the metric should be evaluated to avoid starting interferences.
* The [warmup] time unit depends on the Slo: for the lag trend it is in seconds.
*/
/* @JsonDeserialize
@JsonDeserialize
@RegisterForReflection
class Slo : KubernetesResource {
lateinit var name: String
lateinit var sloType: String
lateinit var prometheusUrl: String
var offset by Delegates.notNull<Int>()
lateinit var properties: MutableMap<String, String>
}*/
var prometheusUrl: String? = null
var offset : Int? = null
var properties: MutableMap<String, String>? = null
}
/**
* Represents a Load that should be created and checked.
......
......@@ -40,7 +40,7 @@ class KubernetesBenchmark : KubernetesResource, Benchmark {
lateinit var name: String
lateinit var resourceTypes: List<TypeName>
lateinit var loadTypes: List<TypeName>
lateinit var slos: List<Slo>
lateinit var slos: MutableList<Slo>
var kafkaConfig: KafkaConfig? = null
lateinit var infrastructure: Resources
lateinit var sut: Resources
......
......@@ -7,12 +7,11 @@ import javax.enterprise.context.ApplicationScoped
private const val CONSUMER_LAG_QUERY = "sum by(consumergroup) (kafka_consumergroup_lag >= 0)"
private const val DROPPED_RECORDS_QUERY = "sum by(job) (kafka_streams_stream_task_metrics_dropped_records_total>=0)"
//TODO: slo.sloType.toLowerCase() is deprecated
@ApplicationScoped
class SloConfigHandler {
companion object {
fun getQueryString(slo: KubernetesBenchmark.Slo): String {
return when (slo.sloType.toLowerCase()) {
return when (slo.sloType.lowercase()) {
SloTypes.GENERIC.value -> slo.properties["promQLQuery"] ?: throw IllegalArgumentException("promQLQuery expected")
SloTypes.LAG_TREND.value, SloTypes.LAG_TREND_RATIO.value -> CONSUMER_LAG_QUERY
SloTypes.DROPPED_RECORDS.value, SloTypes.DROPPED_RECORDS_RATIO.value -> DROPPED_RECORDS_QUERY
......
......@@ -8,14 +8,16 @@ class SloFactory {
fun createSlos(execution: BenchmarkExecution, benchmark: KubernetesBenchmark): List<KubernetesBenchmark.Slo> {
var benchmarkSlos = benchmark.slos
var executionSlos = execution.slos
//TODO: test if we can actually overwrite entries of the objects
for(executionSlo in executionSlos) {
for(benchmarkSlo in benchmarkSlos) {
if(executionSlo.name == benchmarkSlo.name) {
benchmarkSlo.offset = executionSlo.offset ?: benchmarkSlo.offset
benchmarkSlo.prometheusUrl = executionSlo.prometheusUrl ?: benchmarkSlo.prometheusUrl
for(executionProperty in executionSlo.properties) {
benchmarkSlo.properties[executionProperty.key] = executionProperty.value
for(i in 0..benchmarkSlos.size) {
if(executionSlo.name == benchmarkSlos[i].name) {
benchmarkSlos[i].offset = executionSlo.offset ?: benchmarkSlos[i].offset
benchmarkSlos[i].prometheusUrl = executionSlo.prometheusUrl ?: benchmarkSlos[i].prometheusUrl
if (executionSlo.properties != null) {
for (executionProperty in executionSlo.properties!!) {
benchmarkSlos[i].properties[executionProperty.key] = executionProperty.value
}
}
}
}
......
......@@ -43,6 +43,7 @@ class BenchmarkCRDummy(name: String) {
benchmark.resourceTypes = emptyList()
benchmark.loadTypes = emptyList()
benchmark.slos = mutableListOf()
benchmark.kafkaConfig = kafkaConfig
benchmark.name = benchmarkCR.metadata.name
}
......
......@@ -28,6 +28,15 @@ spec:
resource: "uc1-load-generator-deployment.yaml"
properties:
loadGenMaxRecords: "15000"
slos:
- name: "lag trend"
sloType: "lag trend"
prometheusUrl: "http://prometheus-operated:9090"
offset: 0
properties:
threshold: 3000
externalSloUrl: "http://localhost:80/evaluate-slope"
warmup: 60 # in seconds
kafkaConfig:
bootstrapServer: "theodolite-kafka-kafka-bootstrap:9092"
topics:
......
......@@ -12,7 +12,7 @@ spec:
resourceType: "Instances"
resourceValues: [1, 2, 3, 4, 5]
slos:
- sloType: "lag trend"
- name: "lag trend"
threshold: 2000
prometheusUrl: "http://prometheus-operated:9090"
externalSloUrl: "http://localhost:80/evaluate-slope"
......
......@@ -12,13 +12,9 @@ spec:
resourceType: "Instances"
resourceValues: [1, 2, 3, 4, 5]
slos:
- sloType: "lag trend"
prometheusUrl: "http://prometheus-operated:9090"
offset: 0
- name: "lag trend"
properties:
threshold: 2000
externalSloUrl: "http://localhost:80/evaluate-slope"
warmup: 60 # in seconds
execution:
strategy: "LinearSearch"
duration: 300 # in seconds
......
......@@ -12,13 +12,9 @@ spec:
resourceType: "Instances"
resourceValues: [1, 2, 3, 4, 5]
slos:
- sloType: "lag trend"
prometheusUrl: "http://prometheus-operated:9090"
offset: 0
- name: "lag trend"
properties:
threshold: 2000
externalSloUrl: "http://localhost:80/evaluate-slope"
warmup: 60 # in seconds
execution:
strategy: "LinearSearch"
duration: 300 # in seconds
......
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