Skip to content
Snippets Groups Projects
Commit 4151af82 authored by Lorenz Boguhn's avatar Lorenz Boguhn Committed by Lorenz Boguhn
Browse files

Enhance empty query case

parent 158aad8a
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
This commit is part of merge request !83. Comments created here will be created in the context of that merge request.
......@@ -3,10 +3,13 @@ package theodolite.evaluation
import com.google.gson.Gson
import khttp.get
import khttp.responses.Response
import mu.KotlinLogging
import theodolite.util.PrometheusResponse
import java.net.ConnectException
import java.util.*
private val logger = KotlinLogging.logger {}
class MetricFetcher(private val prometheusURL: String) {
......@@ -22,8 +25,15 @@ class MetricFetcher(private val prometheusURL: String) {
while (trys < 2) {
val response = get("$prometheusURL/api/v1/query_range", params = parameter)
if (response.statusCode != 200) {
val message = response.jsonObject.toString()
logger.warn { "Could not connect to Prometheus: $message, retrying now" }
trys++
} else {
var values = parseValues(response)
if (values.data?.result.isNullOrEmpty()) {
logger.warn { "Empty query result: $values" }
throw NoSuchFieldException()
}
return parseValues(response)
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment