From 4562f52c9b540944200b33d4ffbd60b3cbc5ee79 Mon Sep 17 00:00:00 2001 From: mjkwiatkowski Date: Wed, 17 Jun 2026 18:08:56 +0200 Subject: feat: managed to retrieve metric-by-metric from Redis in real time --- .../org/opendc/compute/failure/models/TraceBasedFailureModel.kt | 4 ++++ .../kotlin/org/opendc/compute/simulator/scheduler/SmartScheduler.kt | 3 --- .../org/opendc/compute/simulator/telemetry/KafkaComputeMonitor.kt | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'opendc-compute') diff --git a/opendc-compute/opendc-compute-failure/src/main/kotlin/org/opendc/compute/failure/models/TraceBasedFailureModel.kt b/opendc-compute/opendc-compute-failure/src/main/kotlin/org/opendc/compute/failure/models/TraceBasedFailureModel.kt index 3bd253da..6cb02bb8 100644 --- a/opendc-compute/opendc-compute-failure/src/main/kotlin/org/opendc/compute/failure/models/TraceBasedFailureModel.kt +++ b/opendc-compute/opendc-compute-failure/src/main/kotlin/org/opendc/compute/failure/models/TraceBasedFailureModel.kt @@ -98,6 +98,10 @@ public class TraceBasedFailureModel( pathToFile: String, startPoint: Double, ): List { + /* + I assume this returns a file descriptor. + @Mateusz Kwiatkowski + */ val trace = Trace.open(File(pathToFile), "failure") val reader = checkNotNull(trace.getTable(TABLE_FAILURES)).newReader() diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/SmartScheduler.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/SmartScheduler.kt index baadd806..0edd97cf 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/SmartScheduler.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/scheduler/SmartScheduler.kt @@ -60,9 +60,6 @@ public class SmartScheduler : ComputeScheduler { return SchedulingResult(SchedulingResultType.EMPTY) } - // Benefits of a digital twin: during operations you make sure what is happening in the real world. - // The use-case is making split-second automated decisions before operators can make them. - // Make a strong case for making a Digital Twin. override fun removeTask( task: ServiceTask, host: HostView?, diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/KafkaComputeMonitor.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/KafkaComputeMonitor.kt index c8368af2..ddd4a28a 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/KafkaComputeMonitor.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/KafkaComputeMonitor.kt @@ -47,6 +47,8 @@ public class KafkaComputeMonitor : ComputeMonitor { .setTasksactive(reader.tasksActive) .setCpuutilization(reader.cpuUtilization) .setEnergyusage(reader.energyUsage) + .setUptime(reader.uptime.toDouble()) + .setDowntime(reader.downtime.toDouble()) .build() this.send(packet) -- cgit v1.2.3