summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2022-05-06 14:01:36 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-05-06 18:37:36 +0200
commit260e2228afea08868e8f7f07233b1861b2d7f0c7 (patch)
tree2e9938f63c42e5d02fe203e049377d1d17b5d782
parent0e8ad565a78dd194e687003e5ccc8ccf9b28667f (diff)
refactor(telemetry): Remove dependency on OpenTelemetry SDK
This change removes the dependency on the OpenTelemetry SDK. Instead, we'll only expose metrics via the OpenTelemetry API in the future via adapter classes.
-rw-r--r--gradle/libs.versions.toml9
-rw-r--r--opendc-compute/opendc-compute-workload/build.gradle.kts1
-rw-r--r--opendc-telemetry/build.gradle.kts27
-rw-r--r--opendc-telemetry/opendc-telemetry-api/build.gradle.kts32
-rw-r--r--opendc-telemetry/opendc-telemetry-sdk/build.gradle.kts37
-rw-r--r--opendc-telemetry/opendc-telemetry-sdk/src/main/kotlin/org/opendc/telemetry/sdk/OtelClockAdapter.kt39
-rw-r--r--opendc-telemetry/opendc-telemetry-sdk/src/main/kotlin/org/opendc/telemetry/sdk/metrics/export/CoroutineMetricReader.kt106
-rw-r--r--settings.gradle.kts2
8 files changed, 0 insertions, 253 deletions
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index b05af368..55975919 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -21,9 +21,6 @@ ktlint-gradle = "10.2.1"
log4j = "2.17.2"
microprofile-openapi = "3.0"
mockk = "1.12.3"
-opentelemetry-main = "1.12.0"
-opentelemetry-metrics = "1.12.0-alpha"
-opentelemetry-semconv = "1.12.0-alpha"
parquet = "1.12.2"
progressbar = "0.9.2"
quarkus = "2.8.1.Final"
@@ -45,12 +42,6 @@ slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
log4j-slf4j = { module = "org.apache.logging.log4j:log4j-slf4j-impl", version.ref = "log4j" }
sentry-log4j2 = { module = "io.sentry:sentry-log4j2", version.ref = "sentry" }
-# Telemetry
-opentelemetry-api = { module = "io.opentelemetry:opentelemetry-api", version.ref = "opentelemetry-main" }
-opentelemetry-sdk-main = { module = "io.opentelemetry:opentelemetry-sdk", version.ref = "opentelemetry-main" }
-opentelemetry-sdk-metrics = { module = "io.opentelemetry:opentelemetry-sdk-metrics", version.ref = "opentelemetry-metrics" }
-opentelemetry-semconv = { module = "io.opentelemetry:opentelemetry-semconv", version.ref = "opentelemetry-semconv" }
-
# Testing
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit-jupiter" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit-jupiter" }
diff --git a/opendc-compute/opendc-compute-workload/build.gradle.kts b/opendc-compute/opendc-compute-workload/build.gradle.kts
index e8a7c9fd..7b5fe6c1 100644
--- a/opendc-compute/opendc-compute-workload/build.gradle.kts
+++ b/opendc-compute/opendc-compute-workload/build.gradle.kts
@@ -34,7 +34,6 @@ dependencies {
implementation(projects.opendcTrace.opendcTraceParquet)
implementation(projects.opendcSimulator.opendcSimulatorCore)
implementation(projects.opendcSimulator.opendcSimulatorCompute)
- implementation(libs.opentelemetry.semconv)
implementation(libs.kotlin.logging)
diff --git a/opendc-telemetry/build.gradle.kts b/opendc-telemetry/build.gradle.kts
deleted file mode 100644
index 6473a29e..00000000
--- a/opendc-telemetry/build.gradle.kts
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-description = "Telemetry processing for OpenDC"
-
-subprojects {
- group = "org.opendc.telemetry"
-}
diff --git a/opendc-telemetry/opendc-telemetry-api/build.gradle.kts b/opendc-telemetry/opendc-telemetry-api/build.gradle.kts
deleted file mode 100644
index 32a36d68..00000000
--- a/opendc-telemetry/opendc-telemetry-api/build.gradle.kts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-description = "Telemetry API for OpenDC"
-
-/* Build configuration */
-plugins {
- `kotlin-library-conventions`
-}
-
-dependencies {
- api(libs.opentelemetry.api)
-}
diff --git a/opendc-telemetry/opendc-telemetry-sdk/build.gradle.kts b/opendc-telemetry/opendc-telemetry-sdk/build.gradle.kts
deleted file mode 100644
index 4b3241bc..00000000
--- a/opendc-telemetry/opendc-telemetry-sdk/build.gradle.kts
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-description = "Telemetry SDK for OpenDC"
-
-/* Build configuration */
-plugins {
- `kotlin-library-conventions`
-}
-
-dependencies {
- api(projects.opendcTelemetry.opendcTelemetryApi)
- api(libs.kotlinx.coroutines)
- api(libs.opentelemetry.sdk.main)
- api(libs.opentelemetry.sdk.metrics)
-
- implementation(libs.kotlin.logging)
-}
diff --git a/opendc-telemetry/opendc-telemetry-sdk/src/main/kotlin/org/opendc/telemetry/sdk/OtelClockAdapter.kt b/opendc-telemetry/opendc-telemetry-sdk/src/main/kotlin/org/opendc/telemetry/sdk/OtelClockAdapter.kt
deleted file mode 100644
index cd191652..00000000
--- a/opendc-telemetry/opendc-telemetry-sdk/src/main/kotlin/org/opendc/telemetry/sdk/OtelClockAdapter.kt
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.telemetry.sdk
-
-import io.opentelemetry.sdk.common.Clock
-
-/**
- * An adapter class that bridges a [java.time.Clock] to a [Clock]
- */
-public class OtelClockAdapter(private val clock: java.time.Clock) : Clock {
- override fun now(): Long = nanoTime()
-
- override fun nanoTime(): Long = clock.millis() * 1_000_000L
-}
-
-/**
- * Convert the specified [java.time.Clock] to a [Clock].
- */
-public fun java.time.Clock.toOtelClock(): Clock = OtelClockAdapter(this)
diff --git a/opendc-telemetry/opendc-telemetry-sdk/src/main/kotlin/org/opendc/telemetry/sdk/metrics/export/CoroutineMetricReader.kt b/opendc-telemetry/opendc-telemetry-sdk/src/main/kotlin/org/opendc/telemetry/sdk/metrics/export/CoroutineMetricReader.kt
deleted file mode 100644
index ca5da079..00000000
--- a/opendc-telemetry/opendc-telemetry-sdk/src/main/kotlin/org/opendc/telemetry/sdk/metrics/export/CoroutineMetricReader.kt
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2021 AtLarge Research
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package org.opendc.telemetry.sdk.metrics.export
-
-import io.opentelemetry.sdk.common.CompletableResultCode
-import io.opentelemetry.sdk.metrics.data.AggregationTemporality
-import io.opentelemetry.sdk.metrics.export.MetricExporter
-import io.opentelemetry.sdk.metrics.export.MetricProducer
-import io.opentelemetry.sdk.metrics.export.MetricReader
-import io.opentelemetry.sdk.metrics.export.MetricReaderFactory
-import kotlinx.coroutines.*
-import mu.KotlinLogging
-import java.time.Duration
-
-/**
- * A helper class to read the metrics from a list of [MetricProducer]s and automatically export the metrics every
- * export interval.
- *
- * The reader runs in a [CoroutineScope] which enables collection of metrics in environments with a custom clock.
- *
- * @param scope The [CoroutineScope] to run the reader in.
- * @param producer The metric producer to gather metrics from.
- * @param exporter The export to export the metrics to.
- * @param exportInterval The export interval.
- */
-public class CoroutineMetricReader private constructor(
- scope: CoroutineScope,
- private val producer: MetricProducer,
- private val exporter: MetricExporter,
- private val exportInterval: Duration
-) : MetricReader {
- private val logger = KotlinLogging.logger {}
-
- /**
- * The background job that is responsible for collecting the metrics every cycle.
- */
- private val job = scope.launch {
- val intervalMs = exportInterval.toMillis()
-
- try {
- while (isActive) {
- delay(intervalMs)
-
- try {
- val metrics = producer.collectAllMetrics()
- val result = exporter.export(metrics)
- result.whenComplete {
- if (!result.isSuccess) {
- logger.warn { "Exporter failed" }
- }
- }
- } catch (cause: Throwable) {
- logger.warn(cause) { "Exporter threw an Exception" }
- }
- }
- } finally {
- exporter.shutdown()
- }
- }
-
- override fun getPreferredTemporality(): AggregationTemporality = AggregationTemporality.CUMULATIVE
-
- override fun flush(): CompletableResultCode {
- return exporter.flush()
- }
-
- override fun shutdown(): CompletableResultCode {
- job.cancel()
- return CompletableResultCode.ofSuccess()
- }
-
- public companion object {
- /**
- * Construct a [MetricReaderFactory] for this metric reader.
- */
- public operator fun invoke(
- scope: CoroutineScope,
- exporter: MetricExporter,
- exportInterval: Duration = Duration.ofMinutes(5)
- ): MetricReaderFactory {
- return MetricReaderFactory { producer ->
- CoroutineMetricReader(scope, producer, exporter, exportInterval)
- }
- }
- }
-}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 06289e72..f651f4c1 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -47,8 +47,6 @@ include(":opendc-simulator:opendc-simulator-flow")
include(":opendc-simulator:opendc-simulator-power")
include(":opendc-simulator:opendc-simulator-network")
include(":opendc-simulator:opendc-simulator-compute")
-include(":opendc-telemetry:opendc-telemetry-api")
-include(":opendc-telemetry:opendc-telemetry-sdk")
include(":opendc-trace:opendc-trace-api")
include(":opendc-trace:opendc-trace-gwf")
include(":opendc-trace:opendc-trace-swf")