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