diff --git a/slope-evaluator/app/main.py b/slope-evaluator/app/main.py index 83709c0f71563d9bd1c29c5f064645144163ea72..b3941d1fed0f77d2046199aaaf5a8b7d4edcf680 100644 --- a/slope-evaluator/app/main.py +++ b/slope-evaluator/app/main.py @@ -46,6 +46,13 @@ def execute(results, threshold, warmup): @app.post("/evaluate-slope",response_model=bool) async def evaluate_slope(request: Request): data = json.loads(await request.body()) - return execute(data['total_lag'], data['threshold'], data['warmup']) + results = [] + for total_lag in data['total_lags']: + results.append(execute(total_lag, data['threshold'], data['warmup'] )) + + for result in results: + if not result: + return False + return True logger.info("Slope evaluator is online") \ No newline at end of file diff --git a/slope-evaluator/requirements.txt b/slope-evaluator/requirements.txt index ca77b6c891136b1388aaf56c5ae269d6ee4b5729..6934f4b780a4b7c558c5ce8f1718171e8bec4586 100644 --- a/slope-evaluator/requirements.txt +++ b/slope-evaluator/requirements.txt @@ -1,3 +1,4 @@ fastapi==0.55.1 scikit-learn==0.20.3 pandas==1.0.3 +uvicorn diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt index 5916e10c36e27fbcf48082fa75eb7d69335ec864..2fbe81e94232f379834174df2b05b177808088eb 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt @@ -20,7 +20,7 @@ class AnalysisExecutor(private val slo: BenchmarkExecution.Slo) { var result = false val exporter = CsvExporter() val prometheusData = executionIntervals.map { interval -> fetcher.fetchMetric( start = interval.first, end = interval.second, query = "sum by(group)(kafka_consumergroup_group_lag >= 0)") } - var repetitionCounter = 0 + var repetitionCounter = 1 prometheusData.forEach{ data -> exporter.toCsv(name = "${load.get()}_${res.get()}_${slo.sloType}_rep_${repetitionCounter++}", prom = data) } prometheusData.forEach { logger.info { "prom-data: $it" }} diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/ExternalSloChecker.kt b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/ExternalSloChecker.kt index 211117ade66f53414246e8af3187a047ce82b15f..e1952735937fc1c7e7e4f69d6a07aaa70ba3e0b8 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/ExternalSloChecker.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/ExternalSloChecker.kt @@ -21,14 +21,14 @@ class ExternalSloChecker( override fun evaluate(fetchedData: List<PrometheusResponse>): Boolean { var counter = 0 - var requestData = fetchedData.map { entry -> Gson().toJson(mapOf("total_lag" to entry.data?.result)) }.toMutableList() - requestData.add(mapOf("threshold" to threshold).toString()) - requestData.add(mapOf("warmup" to warmup).toString()) - + val data = Gson().toJson(mapOf( + "total_lags" to fetchedData.map { it.data?.result }, + "threshold" to threshold, + "warmup" to warmup)) while (counter < RETRIES) { - val result = post(externalSlopeURL, data = requestData, timeout = TIMEOUT) + val result = post(externalSlopeURL, data = data, timeout = TIMEOUT) if (result.statusCode != 200) { counter++ logger.error { "Could not reach external slope analysis" } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt index 3b21886f05faa1bc4f75dba39c72e84e006ec693..e16fd0e6b4e80ab65063490f2efdc35244f5c502 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt @@ -25,6 +25,7 @@ class BenchmarkExecutorImpl( val executionIntervals: MutableList<Pair<Instant, Instant>> = ArrayList(repetitions) for (i in 1.rangeTo(repetitions)) { + logger.info { "Run repetition $i/$repetitions" } if (this.run.get()) { executionIntervals.add(runSingleExperiment(load,res)) } else { @@ -33,7 +34,6 @@ class BenchmarkExecutorImpl( } if (this.run.get()) { - executionIntervals.forEach{ logger.info { "interval for evaluation; from: ${it.first}, to: ${it.second}"}} result =AnalysisExecutor(slo = slo) .analyze(load = load, res = res, executionIntervals = executionIntervals) this.results.setResult(Pair(load, res), result)