Skip to content
Snippets Groups Projects
Commit a900b84d authored by Benedikt Wetzel's avatar Benedikt Wetzel
Browse files

minor code enhancements

parent 4ae892bd
Branches
Tags
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!137Allow multiple repititions of an experiment,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
......@@ -5,7 +5,7 @@
For development:
```sh
uvicorn main:app --reload
uvicorn main:app --reload # run this command inside the app/ folder
```
Build the docker image:
......@@ -32,7 +32,7 @@ The running webserver provides a REST API with the following route:
* /evaluate-slope
* Method: POST
* Body:
* total_lag
* total_lags
* threshold
* warmup
......@@ -41,6 +41,7 @@ The body of the request must be a JSON string that satisfies the following condi
* **total_lag**: This property is based on the [Range Vector type](https://www.prometheus.io/docs/prometheus/latest/querying/api/#range-vectors) from Prometheus and must have the following JSON structure:
```
{
[
"metric": {
"group": "<label_value>"
},
......@@ -50,6 +51,7 @@ The body of the request must be a JSON string that satisfies the following condi
"<sample_value>"
]
]
]
}
```
* The `<label_value>` provided in "metric.group" must be equal to the id of the Kafka consumer group.
......
......@@ -46,13 +46,7 @@ def execute(results, threshold, warmup):
@app.post("/evaluate-slope",response_model=bool)
async def evaluate_slope(request: Request):
data = json.loads(await request.body())
results = []
for total_lag in data['total_lags']:
results.append(execute(total_lag, data['threshold'], data['warmup'] ))
results = [execute(total_lag, data['threshold'], data['warmup']) for total_lag in data['total_lags']]
return all(results)
for result in results:
if not result:
return False
return True
logger.info("Slope evaluator is online")
\ No newline at end of file
logger.info("SLO evaluator is online")
\ No newline at end of file
......@@ -52,7 +52,7 @@ class AnalysisExecutor(
val fileName= "${resultsFolder}exp${executionId}_${load.get()}_${res.get()}_${slo.sloType.toSlug()}"
prometheusData.forEach{ data ->
exporter.toCsv(name = "${fileName}_rep_${repetitionCounter++}", prom = data) }
exporter.toCsv(name = "${fileName}_${repetitionCounter++}", prom = data) }
val sloChecker = SloCheckerFactory().create(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment