Skip to content

Commit 51617f3

Browse files
committed
Fix unit in system metrics
1 parent 0adc58b commit 51617f3

File tree

2 files changed

+11
-9
lines changed
  • instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics

2 files changed

+11
-9
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2828
([#2874](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2874))
2929
- `opentelemetry-instrumentation-confluent-kafka` Fix to allow `topic` to be extracted from `kwargs` in `produce()`
3030
([#2901])(https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2901)
31+
- `opentelemetry-instrumentation-system-metrics` Update metric units to conform to UCUM conventions.
32+
([#2922](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2922))
3133

3234
### Breaking changes
3335

instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _instrument(self, **kwargs):
190190
name="system.cpu.time",
191191
callbacks=[self._get_system_cpu_time],
192192
description="System CPU time",
193-
unit="seconds",
193+
unit="s",
194194
)
195195

196196
if "system.cpu.utilization" in self._config:
@@ -206,7 +206,7 @@ def _instrument(self, **kwargs):
206206
name="system.memory.usage",
207207
callbacks=[self._get_system_memory_usage],
208208
description="System memory usage",
209-
unit="bytes",
209+
unit="By",
210210
)
211211

212212
if "system.memory.utilization" in self._config:
@@ -257,7 +257,7 @@ def _instrument(self, **kwargs):
257257
name="system.disk.io",
258258
callbacks=[self._get_system_disk_io],
259259
description="System disk IO",
260-
unit="bytes",
260+
unit="By",
261261
)
262262

263263
if "system.disk.operations" in self._config:
@@ -273,7 +273,7 @@ def _instrument(self, **kwargs):
273273
name="system.disk.time",
274274
callbacks=[self._get_system_disk_time],
275275
description="System disk time",
276-
unit="seconds",
276+
unit="s",
277277
)
278278

279279
# TODO Add _get_system_filesystem_usage
@@ -282,7 +282,7 @@ def _instrument(self, **kwargs):
282282
# callback=self._get_system_filesystem_usage,
283283
# name="system.filesystem.usage",
284284
# description="System filesystem usage",
285-
# unit="bytes",
285+
# unit="By",
286286
# value_type=int,
287287
# )
288288

@@ -327,7 +327,7 @@ def _instrument(self, **kwargs):
327327
name="system.network.io",
328328
callbacks=[self._get_system_network_io],
329329
description="System network io",
330-
unit="bytes",
330+
unit="By",
331331
)
332332

333333
if "system.network.connections" in self._config:
@@ -350,15 +350,15 @@ def _instrument(self, **kwargs):
350350
name=f"process.runtime.{self._python_implementation}.memory",
351351
callbacks=[self._get_runtime_memory],
352352
description=f"Runtime {self._python_implementation} memory",
353-
unit="bytes",
353+
unit="By",
354354
)
355355

356356
if "process.runtime.cpu.time" in self._config:
357357
self._meter.create_observable_counter(
358358
name=f"process.runtime.{self._python_implementation}.cpu_time",
359359
callbacks=[self._get_runtime_cpu_time],
360360
description=f"Runtime {self._python_implementation} CPU time",
361-
unit="seconds",
361+
unit="s",
362362
)
363363

364364
if "process.runtime.gc_count" in self._config:
@@ -371,7 +371,7 @@ def _instrument(self, **kwargs):
371371
name=f"process.runtime.{self._python_implementation}.gc_count",
372372
callbacks=[self._get_runtime_gc_count],
373373
description=f"Runtime {self._python_implementation} GC count",
374-
unit="bytes",
374+
unit="By",
375375
)
376376

377377
if "process.runtime.thread_count" in self._config:

0 commit comments

Comments
 (0)