summaryrefslogtreecommitdiff
path: root/opendc-experiments/opendc-experiments-tf20/src
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-08-25 20:33:52 +0200
committerGitHub <noreply@github.com>2021-08-25 20:33:52 +0200
commit4f333808d823abadd603ef2221092d82dc0f02b4 (patch)
tree8e9b054a770b3a048b5cfb44e3f6bb4dff57315e /opendc-experiments/opendc-experiments-tf20/src
parentac48fa12f36180de31154a7c828b4dc281dac94b (diff)
parente5b79b18dab4f2874f3c5730b7e599dc74573c8d (diff)
merge: Upgrade to OpenTelemetry 1.5
This pull request updates to OpenTelemetry version 1.5.0. * Update dependency to OpenTelemetry 1.5 * Fix breaking changes in metrics API * Eliminate unnecessary double to long conversions * Simplify metric extraction for monitor
Diffstat (limited to 'opendc-experiments/opendc-experiments-tf20/src')
-rw-r--r--opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt16
1 files changed, 11 insertions, 5 deletions
diff --git a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt
index d8f92155..0873aac9 100644
--- a/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt
+++ b/opendc-experiments/opendc-experiments-tf20/src/main/kotlin/org/opendc/experiments/tf20/core/SimTFDevice.kt
@@ -22,8 +22,9 @@
package org.opendc.experiments.tf20.core
+import io.opentelemetry.api.common.AttributeKey
+import io.opentelemetry.api.common.Attributes
import io.opentelemetry.api.metrics.Meter
-import io.opentelemetry.api.metrics.common.Labels
import kotlinx.coroutines.*
import org.opendc.simulator.compute.SimBareMetalMachine
import org.opendc.simulator.compute.SimMachine
@@ -68,22 +69,27 @@ public class SimTFDevice(
)
/**
+ * The identifier of a device.
+ */
+ private val deviceId = AttributeKey.stringKey("device.id")
+
+ /**
* The usage of the device.
*/
- private val _usage = meter.doubleValueRecorderBuilder("device.usage")
+ private val _usage = meter.histogramBuilder("device.usage")
.setDescription("The amount of device resources used")
.setUnit("MHz")
.build()
- .bind(Labels.of("device", uid.toString()))
+ .bind(Attributes.of(deviceId, uid.toString()))
/**
* The power draw of the device.
*/
- private val _power = meter.doubleValueRecorderBuilder("device.power")
+ private val _power = meter.histogramBuilder("device.power")
.setDescription("The power draw of the device")
.setUnit("W")
.build()
- .bind(Labels.of("device", uid.toString()))
+ .bind(Attributes.of(deviceId, uid.toString()))
/**
* The workload that will be run by the device.