From a88c3ea5203054b8090c4621f09da121b4890726 Mon Sep 17 00:00:00 2001
From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de>
Date: Thu, 22 Apr 2021 13:53:36 +0200
Subject: [PATCH] add logging

---
 .../config/example-benchmark-yaml-resource.yaml          | 2 +-
 .../kotlin/theodolite/evaluation/AnalysisExecutor.kt     | 2 ++
 .../kotlin/theodolite/evaluation/ExternalSloChecker.kt   | 1 +
 .../kotlin/theodolite/execution/BenchmarkExecutorImpl.kt | 9 ++++++---
 .../theodolite/execution/TheodoliteYamlExecutor.kt       | 4 ++--
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml
index 42b1cd08d..4d3d6ef39 100644
--- a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml
+++ b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml
@@ -20,7 +20,7 @@ loadTypes:
         container: "workload-generator"
         variableName: "NUM_SENSORS"
 kafkaConfig:
-  bootstrapServer: "my-confluent-cp-kafka:9092"
+  bootstrapServer: "localhost:31290" # "my-confluent-cp-kafka:9092"
   topics:
     - name: "input"
       numPartitions: 40
diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt
index bb2dc7ed8..5916e10c3 100644
--- a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt
+++ b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/AnalysisExecutor.kt
@@ -22,6 +22,8 @@ class AnalysisExecutor(private val slo: BenchmarkExecution.Slo) {
         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
         prometheusData.forEach{ data -> exporter.toCsv(name = "${load.get()}_${res.get()}_${slo.sloType}_rep_${repetitionCounter++}", prom = data) }
+        prometheusData.forEach { logger.info { "prom-data: $it" }}
+
         try {
 
             val sloChecker = SloCheckerFactory().create(
diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/ExternalSloChecker.kt b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/ExternalSloChecker.kt
index 74a121e41..211117ade 100644
--- a/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/ExternalSloChecker.kt
+++ b/theodolite-quarkus/src/main/kotlin/theodolite/evaluation/ExternalSloChecker.kt
@@ -26,6 +26,7 @@ class ExternalSloChecker(
         requestData.add(mapOf("warmup" to warmup).toString())
 
 
+
         while (counter < RETRIES) {
             val result = post(externalSlopeURL, data = requestData, timeout = TIMEOUT)
             if (result.statusCode != 200) {
diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt
index 9750558fe..3b21886f0 100644
--- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt
+++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/BenchmarkExecutorImpl.kt
@@ -23,16 +23,19 @@ class BenchmarkExecutorImpl(
     override fun runExperiment(load: LoadDimension, res: Resource): Boolean {
         var result = false
         val executionIntervals: MutableList<Pair<Instant, Instant>> = ArrayList(repetitions)
-        executionIntervals
+
         for (i in 1.rangeTo(repetitions)) {
             if (this.run.get()) {
                 executionIntervals.add(runSingleExperiment(load,res))
+            } else {
+                break
             }
         }
 
         if (this.run.get()) {
-            result =
-                AnalysisExecutor(slo = slo).analyze(load = load, res = res, executionIntervals = executionIntervals)
+            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)
         }
         return result
diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt
index 6bddea20c..cfd49eb83 100644
--- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt
+++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt
@@ -15,8 +15,8 @@ class TheodoliteYamlExecutor {
     fun start() {
         logger.info { "Theodolite started" }
 
-        val executionPath = System.getenv("THEODOLITE_EXECUTION") ?: "./config/BenchmarkExecution.yaml"
-        val benchmarkPath = System.getenv("THEODOLITE_BENCHMARK") ?: "./config/BenchmarkType.yaml"
+        val executionPath = System.getenv("THEODOLITE_EXECUTION") ?: "./config/example-execution-yaml-resource.yaml"
+        val benchmarkPath = System.getenv("THEODOLITE_BENCHMARK") ?: "./config/example-benchmark-yaml-resource.yaml"
 
         logger.info { "Using $executionPath for BenchmarkExecution" }
         logger.info { "Using $benchmarkPath for BenchmarkType" }
-- 
GitLab