diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/MetricFetcher.kt b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/MetricFetcher.kt index da70ab10b1270c05dc467d98f615d4046f4c3992..9c80668ab1d4b1716d37cdc4b484ed164ef81ff8 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/MetricFetcher.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/MetricFetcher.kt @@ -13,7 +13,9 @@ private val logger = KotlinLogging.logger {} class MetricFetcher(private val prometheusURL: String) { + // Instant fun fetchMetric(start: Long, end: Long, query: String): PrometheusResponse { + // TODO handle timeouts var trys = 0 val parameter = mapOf( "query" to query, @@ -40,6 +42,7 @@ class MetricFetcher(private val prometheusURL: String) { throw ConnectException("No answer from Prometheus received") } + // TODO required? private fun toISODate(timestamp: Long): String { val sdf = java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.sss'Z'") val date = Date(timestamp - (3600 * 1000))//subtract 1h since cluster is in another timezone diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/SLOCheckerImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/SLOCheckerImpl.kt index 084d07c95ddf23365bcf1c146aeb2cfd96752757..d602a76811dff1df6e6eeecfee9d59a2f1f295e3 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/SLOCheckerImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/SLOCheckerImpl.kt @@ -9,10 +9,11 @@ class SLOCheckerImpl(private val prometheusURL: String) : SLOChecker { override fun evaluate(start: Long, end: Long): Boolean { var counter = 0 val metricFetcher = MetricFetcher(prometheusURL = prometheusURL) - val fetchedData = metricFetcher.fetchMetric(start, end, "sum by(group)(kafka_consumergroup_group_lag > 0)") + val fetchedData = metricFetcher.fetchMetric(start, end, "sum by(group)(kafka_consumergroup_group_lag >= 0)") val data = JSONObject(mapOf("total_lag" to fetchedData.data?.result)) while (counter < 2) { + // TODO handle timeouts val result = post("http://127.0.0.1:8000/evaluate-slope", data = data) if (result.statusCode != 200) { counter++ diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index ff15e645246ade37bccdb2032a8a4bfd263594b7..630bb343acb858e1deace08caef8e4656cce333f 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -23,8 +23,8 @@ class BenchmarkExecutorImpl( benchmarkDeployment.teardown() // todo evaluate val result = SLOCheckerImpl("http://localhost:32656") - .evaluate( //TODO FIX HERE - Instant.now().toEpochMilli() - executionDuration.toMillis(), + .evaluate( //TODO FIX HERE, catch exception -> return false + Instant.now().toEpochMilli() - executionDuration.toMillis(), // TODO instant.minus(duration) Instant.now().toEpochMilli() ) this.results.setResult(Pair(load, res), result)