diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-08-25 20:33:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-25 20:33:52 +0200 |
| commit | 4f333808d823abadd603ef2221092d82dc0f02b4 (patch) | |
| tree | 8e9b054a770b3a048b5cfb44e3f6bb4dff57315e /opendc-experiments/opendc-experiments-tf20/src | |
| parent | ac48fa12f36180de31154a7c828b4dc281dac94b (diff) | |
| parent | e5b79b18dab4f2874f3c5730b7e599dc74573c8d (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.kt | 16 |
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. |
