Skip to content
Snippets Groups Projects
Commit 612e3f7a authored by Lorenz Boguhn's avatar Lorenz Boguhn
Browse files

Cleanup RETRYS

parent d55b5244
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!96Handle shutdown,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
...@@ -16,7 +16,7 @@ class ExternalSloChecker( ...@@ -16,7 +16,7 @@ class ExternalSloChecker(
) : ) :
SloChecker { SloChecker {
private val RETRYS = 2 private val RETRIES = 2
private val TIMEOUT = 60.0 private val TIMEOUT = 60.0
override fun evaluate(start: Instant, end: Instant): Boolean { override fun evaluate(start: Instant, end: Instant): Boolean {
...@@ -26,7 +26,7 @@ class ExternalSloChecker( ...@@ -26,7 +26,7 @@ class ExternalSloChecker(
val data = val data =
Gson().toJson(mapOf("total_lag" to fetchedData.data?.result, "threshold" to threshold, "warmup" to warmup)) Gson().toJson(mapOf("total_lag" to fetchedData.data?.result, "threshold" to threshold, "warmup" to warmup))
while (counter < RETRYS) { while (counter < RETRIES) {
val result = post(externalSlopeURL, data = data, timeout = TIMEOUT) val result = post(externalSlopeURL, data = data, timeout = TIMEOUT)
if (result.statusCode != 200) { if (result.statusCode != 200) {
counter++ counter++
......
...@@ -12,7 +12,7 @@ import java.time.Instant ...@@ -12,7 +12,7 @@ import java.time.Instant
private val logger = KotlinLogging.logger {} private val logger = KotlinLogging.logger {}
class MetricFetcher(private val prometheusURL: String, private val offset: Duration) { class MetricFetcher(private val prometheusURL: String, private val offset: Duration) {
private val RETRYS = 2 private val RETRIES = 2
private val TIMEOUT = 60.0 private val TIMEOUT = 60.0
fun fetchMetric(start: Instant, end: Instant, query: String): PrometheusResponse { fun fetchMetric(start: Instant, end: Instant, query: String): PrometheusResponse {
...@@ -28,7 +28,7 @@ class MetricFetcher(private val prometheusURL: String, private val offset: Durat ...@@ -28,7 +28,7 @@ class MetricFetcher(private val prometheusURL: String, private val offset: Durat
"step" to "5s" "step" to "5s"
) )
while (counter < RETRYS) { while (counter < RETRIES) {
val response = get("$prometheusURL/api/v1/query_range", params = parameter, timeout = TIMEOUT) val response = get("$prometheusURL/api/v1/query_range", params = parameter, timeout = TIMEOUT)
if (response.statusCode != 200) { if (response.statusCode != 200) {
val message = response.jsonObject.toString() val message = response.jsonObject.toString()
......
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