From 4fa8de250e3ed639bb59b1c176caa89cdacf2dfc Mon Sep 17 00:00:00 2001 From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de> Date: Mon, 15 Nov 2021 13:23:04 +0100 Subject: [PATCH] clean up --- .../main/kotlin/theodolite/evaluation/AnalysisExecutor.kt | 1 - .../main/kotlin/theodolite/evaluation/SloConfigHandler.kt | 7 +++++-- .../kotlin/theodolite/execution/BenchmarkExecutorImpl.kt | 2 -- .../src/main/kotlin/theodolite/util/PrometheusResponse.kt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/theodolite/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt b/theodolite/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt index 709dc9f0a..5d5e1e621 100644 --- a/theodolite/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt +++ b/theodolite/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt @@ -36,7 +36,6 @@ class AnalysisExecutor( * @return true if the experiment succeeded. */ fun analyze(load: LoadDimension, res: Resource, executionIntervals: List<Pair<Instant, Instant>>): Boolean { - var result = false var repetitionCounter = 1 diff --git a/theodolite/src/main/kotlin/theodolite/evaluation/SloConfigHandler.kt b/theodolite/src/main/kotlin/theodolite/evaluation/SloConfigHandler.kt index 2328000e7..93929218c 100644 --- a/theodolite/src/main/kotlin/theodolite/evaluation/SloConfigHandler.kt +++ b/theodolite/src/main/kotlin/theodolite/evaluation/SloConfigHandler.kt @@ -3,13 +3,16 @@ package theodolite.evaluation import theodolite.util.InvalidPatcherConfigurationException import javax.enterprise.context.ApplicationScoped +private const val CONSUMER_LAG_QUERY = "sum by(group)(kafka_consumergroup_group_lag >= 0)" +private const val DROPPED_RECORDS_QUERY = "sum by(job) (kafka_streams_stream_task_metrics_dropped_records_total>=0)" + @ApplicationScoped class SloConfigHandler() { companion object { fun getQueryString(sloType: String): String { return when (sloType.toLowerCase()) { - SloTypes.LAG_TREND.value, SloTypes.LAG_TREND_RATIO.value -> "sum by(group)(kafka_consumergroup_group_lag >= 0)" - SloTypes.DROPPED_RECORDS.value, SloTypes.DROPPED_RECORDS_RATIO.value -> "sum by(job) (kafka_streams_stream_task_metrics_dropped_records_total>=0)" + SloTypes.LAG_TREND.value, SloTypes.LAG_TREND_RATIO.value -> CONSUMER_LAG_QUERY + SloTypes.DROPPED_RECORDS.value, SloTypes.DROPPED_RECORDS_RATIO.value -> DROPPED_RECORDS_QUERY else -> throw InvalidPatcherConfigurationException("Could not find Prometheus query string for slo type $sloType") } } diff --git a/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index e6f55d982..783063374 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -53,7 +53,6 @@ class BenchmarkExecutorImpl( * Analyse the experiment, if [run] is true, otherwise the experiment was canceled by the user. */ if (this.run.get()) { - val experimentResults = slos.map { AnalysisExecutor(slo = it, executionId = executionId) .analyze( @@ -65,7 +64,6 @@ class BenchmarkExecutorImpl( result = (false !in experimentResults) this.results.setResult(Pair(load, res), result) - } return result } diff --git a/theodolite/src/main/kotlin/theodolite/util/PrometheusResponse.kt b/theodolite/src/main/kotlin/theodolite/util/PrometheusResponse.kt index 72fa6779c..9b0b0dd4e 100644 --- a/theodolite/src/main/kotlin/theodolite/util/PrometheusResponse.kt +++ b/theodolite/src/main/kotlin/theodolite/util/PrometheusResponse.kt @@ -64,7 +64,7 @@ data class PromResult( /** * Label of the metric */ - var metric: Map<String,String>? = null, + var metric: Map<String, String>? = null, /** * Values of the metric (e.g. [ [ <unix_time>, "<sample_value>" ], ... ]) */ -- GitLab