summaryrefslogtreecommitdiff
path: root/opendc-compute/opendc-compute-simulator/src/test
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-08-25 14:06:39 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-08-25 18:04:36 +0200
commitf111081627280d4e7e1d7147c56cdce708e32433 (patch)
tree509c005e0b94c89eeb61cc8df0aee360c1540943 /opendc-compute/opendc-compute-simulator/src/test
parentac48fa12f36180de31154a7c828b4dc281dac94b (diff)
build: Upgrade to OpenTelemetry 1.5
This change upgrades the OpenTelemetry dependency to version 1.5, which contains various breaking changes in the metrics API.
Diffstat (limited to 'opendc-compute/opendc-compute-simulator/src/test')
-rw-r--r--opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt19
1 files changed, 8 insertions, 11 deletions
diff --git a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
index 93a2248a..1ba3a9a1 100644
--- a/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
+++ b/opendc-compute/opendc-compute-simulator/src/test/kotlin/org/opendc/compute/simulator/SimHostTest.kt
@@ -133,17 +133,14 @@ internal class SimHostTest {
object : MetricExporter {
override fun export(metrics: Collection<MetricData>): CompletableResultCode {
val metricsByName = metrics.associateBy { it.name }
- val totalWork = metricsByName["cpu.work.total"]
- if (totalWork != null) {
- requestedWork += totalWork.doubleSummaryData.points.first().sum.toLong()
+ metricsByName["cpu.work.total"]?.let {
+ requestedWork = it.doubleSumData.points.sumOf { point -> point.value }.toLong()
}
- val grantedWorkCycle = metricsByName["cpu.work.granted"]
- if (grantedWorkCycle != null) {
- grantedWork += grantedWorkCycle.doubleSummaryData.points.first().sum.toLong()
+ metricsByName["cpu.work.granted"]?.let {
+ grantedWork = it.doubleSumData.points.sumOf { point -> point.value }.toLong()
}
- val overcommittedWorkCycle = metricsByName["cpu.work.overcommit"]
- if (overcommittedWorkCycle != null) {
- overcommittedWork += overcommittedWorkCycle.doubleSummaryData.points.first().sum.toLong()
+ metricsByName["cpu.work.overcommit"]?.let {
+ overcommittedWork = it.doubleSumData.points.sumOf { point -> point.value }.toLong()
}
return CompletableResultCode.ofSuccess()
}
@@ -236,10 +233,10 @@ internal class SimHostTest {
override fun export(metrics: Collection<MetricData>): CompletableResultCode {
val metricsByName = metrics.associateBy { it.name }
metricsByName["cpu.work.total"]?.let {
- requestedWork += it.doubleSummaryData.points.first().sum.toLong()
+ requestedWork = it.doubleSumData.points.sumOf { point -> point.value }.toLong()
}
metricsByName["cpu.work.granted"]?.let {
- grantedWork += it.doubleSummaryData.points.first().sum.toLong()
+ grantedWork = it.doubleSumData.points.sumOf { point -> point.value }.toLong()
}
return CompletableResultCode.ofSuccess()
}