Skip to content
Snippets Groups Projects
Commit 689c9348 authored by Simon Ehrenstein's avatar Simon Ehrenstein
Browse files

Format kDoc

parent a4565f65
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!112Add Kdoc,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Showing
with 50 additions and 50 deletions
package theodolite.benchmark
/**
* A BenchmarkDeployment contains the necessary infrastructure to execute a Benchmark.
* A BenchmarkDeployment contains the necessary infrastructure to execute a benchmark.
* Therefore it has the capabilities to set up the deployment of a benchmark and to tear it down.
*/
interface BenchmarkDeployment {
/**
* Setup a Benchmark. This method is responsible for deploying the resources
* Setup a benchmark. This method is responsible for deploying the resources
* and organize the needed infrastructure.
*/
fun setup()
/**
* Tears a Benchmark down. This method is responsible for deleting the deployed
* Tears down a benchmark. This method is responsible for deleting the deployed
* resources and to reset the used infrastructure.
*/
fun teardown()
......
......
......@@ -9,19 +9,19 @@ import theodolite.util.ConfigurationOverride
import kotlin.properties.Delegates
/**
* This Class represents the configuration for an Execution of a Benchmark.
* This class represents the configuration for an execution of a benchmark.
* An example for this is the BenchmarkExecution.yaml
* A BenchmarkExecution consists of:
* - A [name].
* - The [benchmark] (a BenchmarkType) that should be executed.
* - The [laod] that should be checked in the benchmark.
* - The [load] that should be checked in the benchmark.
* - The [resources] that should be checked in the benchmark.
* - A List of [slos] that are used for the evaluation of the experiments
* - An [execution] that encapsulates: the [strategy], the [duration], the [repetitions], and the [restrictions]
* - An [execution] that encapsulates: the strategy, the duration, and the restrictions
* for the execution of the benchmark.
* - [configOverrides] additional configurations.
* This class is used for the parsing(in the [TheodoliteYamlExecutor]) and
* for the deserializing in the [TheodoliteOperator].
* This class is used for the parsing(in the [theodolite.execution.TheodoliteYamlExecutor]) and
* for the deserializing in the [theodolite.execution.operator.TheodoliteOperator].
* @constructor construct an empty BenchmarkExecution.
*/
@JsonDeserialize
......@@ -49,8 +49,8 @@ class BenchmarkExecution : CustomResource(), Namespaced {
}
/**
* Measurable Metric.
* It is evaluated using the [ExternalSloChecker] by data measured by Prometheus.
* Measurable metric.
* It is evaluated using the [theodolite.evaluation.ExternalSloChecker] by data measured by Prometheus.
* The evaluation checks if a [threshold] is reached or not.
* It has a [offset] by which the start and end points of the Metric can be shifted.
* The [warmup] determines after which time the metric should be evaluated to avoid starting interferences.
......
......
......@@ -7,13 +7,13 @@ private val logger = KotlinLogging.logger {}
/**
* Used to reset the KafkaLagExporter by deleting the pod.
* @param client KubernetesClient used for the deletion.
* @param client NamespacedKubernetesClient used for the deletion.
*/
class KafkaLagExporterRemover(private val client: NamespacedKubernetesClient) {
/**
* Deletes all pods with the selected label.
* @param label of the pod that should be deleted.
* @param [label] of the pod that should be deleted.
*/
fun remove(label: String) {
this.client.pods().withLabel(label).delete()
......
......
......@@ -15,7 +15,7 @@ private val logger = KotlinLogging.logger {}
private var DEFAULT_NAMESPACE = "default"
/**
* Represents a Benchmark in Kubernetes. An example for this is the BenchmarkType.yaml
* Represents a benchmark in Kubernetes. An example for this is the BenchmarkType.yaml
* Contains a of:
* - [name] of the benchmark,
* - [appResource] list of the resources that have to be deployed for the benchmark,
......@@ -26,8 +26,8 @@ private var DEFAULT_NAMESPACE = "default"
* - [namespace] for the client,
* - [path] under which the resource yamls can be found.
*
* This class is used for the parsing(in the [TheodoliteYamlExecutor]) and
* for the deserializing in the [TheodoliteOperator].
* This class is used for the parsing(in the [theodolite.execution.TheodoliteYamlExecutor]) and
* for the deserializing in the [theodolite.execution.operator.TheodoliteOperator].
* @constructor construct an empty Benchmark.
*/
@RegisterForReflection
......@@ -42,7 +42,7 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced {
lateinit var path: String
/**
* Loads KubernetsResources.
* Loads [KubernetesResource]s.
* It first loads them via the [YamlParser] to check for their concrete type and afterwards initializes them using
* the [K8sResourceLoader]
*/
......@@ -67,7 +67,7 @@ class KubernetesBenchmark : Benchmark, CustomResource(), Namespaced {
}
/**
* Builds a Deployment.
* Builds a deployment.
* First loads all required resources and then patches them to the concrete load and resources for the experiment.
* Afterwards patches additional configurations(cluster depending) into the resources.
* @param load concrete load that will be benchmarked in this experiment.
......
......
......@@ -45,7 +45,7 @@ class KubernetesBenchmarkDeployment(
* Tears a [KubernetesBenchmark] down:
* - Reset the Kafka Lag Exporter.
* - Remove the used topics.
* - Remove the KubernetesResources.
* - Remove the [KubernetesResource]s.
*/
override fun teardown() {
KafkaLagExporterRemover(client).remove(LABEL)
......
......
......@@ -11,7 +11,7 @@ private val logger = KotlinLogging.logger {}
/**
* Contains the analysis. Fetches a metric from Prometheus, documents it, and evaluates it.
* @param slo that is used for the analysis.
* @param slo Slo that is used for the analysis.
*/
class AnalysisExecutor(private val slo: BenchmarkExecution.Slo) {
private val fetcher = MetricFetcher(
......@@ -22,10 +22,10 @@ class AnalysisExecutor(private val slo: BenchmarkExecution.Slo) {
/**
* Analyses an experiment via prometheus data.
* First fetches data from prometheus, then documents them and afterwards evaluate it via a [slo].
* @param load [LoadDimension] of the experiment.
* @param res [Resource] of the experiment.
* @param executionDuration [Duration] of the experiment.
* @return [true] if the experiment succeeded.
* @param load of the experiment.
* @param res of the experiment.
* @param executionDuration of the experiment.
* @return true if the experiment succeeded.
*/
fun analyze(load: LoadDimension, res: Resource, executionDuration: Duration): Boolean {
var result = false
......@@ -40,7 +40,7 @@ class AnalysisExecutor(private val slo: BenchmarkExecution.Slo) {
CsvExporter().toCsv(name = "${load.get()}_${res.get()}_${slo.sloType}", prom = prometheusData)
val sloChecker = SloCheckerFactory().create(
slotype = slo.sloType,
sloType = slo.sloType,
externalSlopeURL = slo.externalSloUrl,
threshold = slo.threshold,
warmup = slo.warmup
......
......
......@@ -14,7 +14,7 @@ private val logger = KotlinLogging.logger {}
class CsvExporter {
/**
* Uses the PrintWriter to transform a PrometheusResponse to a Csv file.
* Uses the [PrintWriter] to transform a [PrometheusResponse] to a Csv file.
* @param name of the file.
* @param prom Response that is documented.
*
......@@ -33,7 +33,7 @@ class CsvExporter {
}
/**
* Converts a PrometheusResponse into a List of List of Strings
* Converts a [PrometheusResponse] into a [List] of [List] of [String]s
*/
private fun promResponseToList(prom: PrometheusResponse): List<List<String>> {
val name = prom.data?.result?.get(0)?.metric?.group.toString()
......
......
......@@ -8,9 +8,9 @@ import java.net.ConnectException
import java.time.Instant
/**
* SloChecker that uses an external source for the concrete evaluation.
* [SloChecker] that uses an external source for the concrete evaluation.
* @param externalSlopeURL The url under which the external evaluation can be reached.
* @param threshold threshold that should not be ... to evaluate to true.
* @param threshold threshold that should not be exceeded to evaluate to true.
* @param warmup time that is not taken into consideration for the evaluation.
*/
class ExternalSloChecker(
......@@ -33,7 +33,7 @@ class ExternalSloChecker(
* @param start point of the experiment.
* @param end point of the experiment.
* @param fetchedData that should be evaluated
* @return [true] if the expirment was successful(the threshold was not exceeded.
* @return true if the experiment was successful(the threshold was not exceeded.
* @throws ConnectException if the external service could not be reached.
*/
override fun evaluate(start: Instant, end: Instant, fetchedData: PrometheusResponse): Boolean {
......
......
......@@ -12,9 +12,9 @@ import java.time.Instant
private val logger = KotlinLogging.logger {}
/**
* Used to fetch Metrics from Prometheus.
* @param prometheusURL - URL to the Prometheus server.
* @param offset - Duration of time that the start and end points of the queries
* Used to fetch metrics from Prometheus.
* @param prometheusURL URL to the Prometheus server.
* @param offset Duration of time that the start and end points of the queries
* should be shifted. (for different timezones, etc..)
*/
class MetricFetcher(private val prometheusURL: String, private val offset: Duration) {
......@@ -22,13 +22,13 @@ class MetricFetcher(private val prometheusURL: String, private val offset: Durat
private val TIMEOUT = 60.0
/**
* Tries to fetch a metric by a query to a PrometheusServer.
* Tries to fetch a metric by a query to a Prometheus server.
* Retries to fetch the metric [RETRIES] times.
* Connects to the server via [prometheusURL].
*
* @param start - start point of the query.
* @param end - end point of the query.
* @param query - query for the prometheus server.
* @param start start point of the query.
* @param end end point of the query.
* @param query query for the prometheus server.
* @throws ConnectException - if the prometheus server timed out/was not reached.
*/
fun fetchMetric(start: Instant, end: Instant, query: String): PrometheusResponse {
......@@ -64,8 +64,8 @@ class MetricFetcher(private val prometheusURL: String, private val offset: Durat
/**
* Deserializes a response from Prometheus.
* @param values - Response from Prometheus.
* @return a PrometheusResponse.
* @param values Response from Prometheus.
* @return a [PrometheusResponse]
*/
private fun parseValues(values: Response): PrometheusResponse {
return Gson().fromJson<PrometheusResponse>(
......
......
......@@ -16,7 +16,7 @@ interface SloChecker {
* @param start of the experiment
* @param end of the experiment
* @param fetchedData from Prometheus that will be evaluated.
* @return [true] if experiment was successful. Otherwise [false].
* @return true if experiment was successful. Otherwise false.
*/
fun evaluate(start: Instant, end: Instant, fetchedData: PrometheusResponse): Boolean
}
package theodolite.evaluation
/**
* Factory used to potentially create different SloCheckers.
* Factory used to potentially create different [SloChecker]s.
* Supports: lag type.
*/
class SloCheckerFactory {
......@@ -10,27 +10,27 @@ class SloCheckerFactory {
* Creates different [SloChecker]s.
* Supports: lag type.
*
* @param slotype Type of the SloChecker.
* @param externalSlopeURL Url to the concrete SlopeChecker.
* @param threshold for the SloChecker.
* @param warmup for the sloChecker.
* @param sloType Type of the [SloChecker].
* @param externalSlopeURL Url to the concrete [SloChecker].
* @param threshold for the [SloChecker].
* @param warmup for the [SloChecker].
*
* @return A SloChecker
* @throws IllegalArgumentException If sloType not supported.
* @return A [SloChecker]
* @throws IllegalArgumentException If [sloType] not supported.
*/
fun create(
slotype: String,
sloType: String,
externalSlopeURL: String,
threshold: Int,
warmup: Int
): SloChecker {
return when (slotype) {
return when (sloType) {
"lag trend" -> ExternalSloChecker(
externalSlopeURL = externalSlopeURL,
threshold = threshold,
warmup = warmup
)
else -> throw IllegalArgumentException("Slotype $slotype not found.")
else -> throw IllegalArgumentException("Slotype $sloType not found.")
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment