Skip to content
Snippets Groups Projects
Commit c278cbb0 authored by Benedikt Wetzel's avatar Benedikt Wetzel Committed by Lorenz Boguhn
Browse files

Add todods/notes

parent 4151af82
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!92Introduce experiment evaluation,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
...@@ -13,7 +13,9 @@ private val logger = KotlinLogging.logger {} ...@@ -13,7 +13,9 @@ private val logger = KotlinLogging.logger {}
class MetricFetcher(private val prometheusURL: String) { class MetricFetcher(private val prometheusURL: String) {
// Instant
fun fetchMetric(start: Long, end: Long, query: String): PrometheusResponse { fun fetchMetric(start: Long, end: Long, query: String): PrometheusResponse {
// TODO handle timeouts
var trys = 0 var trys = 0
val parameter = mapOf( val parameter = mapOf(
"query" to query, "query" to query,
...@@ -40,6 +42,7 @@ class MetricFetcher(private val prometheusURL: String) { ...@@ -40,6 +42,7 @@ class MetricFetcher(private val prometheusURL: String) {
throw ConnectException("No answer from Prometheus received") throw ConnectException("No answer from Prometheus received")
} }
// TODO required?
private fun toISODate(timestamp: Long): String { private fun toISODate(timestamp: Long): String {
val sdf = java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.sss'Z'") 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 val date = Date(timestamp - (3600 * 1000))//subtract 1h since cluster is in another timezone
......
...@@ -9,10 +9,11 @@ class SLOCheckerImpl(private val prometheusURL: String) : SLOChecker { ...@@ -9,10 +9,11 @@ class SLOCheckerImpl(private val prometheusURL: String) : SLOChecker {
override fun evaluate(start: Long, end: Long): Boolean { override fun evaluate(start: Long, end: Long): Boolean {
var counter = 0 var counter = 0
val metricFetcher = MetricFetcher(prometheusURL = prometheusURL) 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)) val data = JSONObject(mapOf("total_lag" to fetchedData.data?.result))
while (counter < 2) { while (counter < 2) {
// TODO handle timeouts
val result = post("http://127.0.0.1:8000/evaluate-slope", data = data) val result = post("http://127.0.0.1:8000/evaluate-slope", data = data)
if (result.statusCode != 200) { if (result.statusCode != 200) {
counter++ counter++
......
...@@ -23,8 +23,8 @@ class BenchmarkExecutorImpl( ...@@ -23,8 +23,8 @@ class BenchmarkExecutorImpl(
benchmarkDeployment.teardown() benchmarkDeployment.teardown()
// todo evaluate // todo evaluate
val result = SLOCheckerImpl("http://localhost:32656") val result = SLOCheckerImpl("http://localhost:32656")
.evaluate( //TODO FIX HERE .evaluate( //TODO FIX HERE, catch exception -> return false
Instant.now().toEpochMilli() - executionDuration.toMillis(), Instant.now().toEpochMilli() - executionDuration.toMillis(), // TODO instant.minus(duration)
Instant.now().toEpochMilli() Instant.now().toEpochMilli()
) )
this.results.setResult(Pair(load, res), result) this.results.setResult(Pair(load, res), result)
......
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