From 8e5d8ef558b1657a49b4bee6ad28462c273568a0 Mon Sep 17 00:00:00 2001 From: Mengyi Zhou Date: Tue, 22 Oct 2024 10:15:42 -0700 Subject: [PATCH] Fix unit in system metrics --- .../instrumentation/system_metrics/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py b/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py index 1b9a36c4cb..01c0fa7af2 100644 --- a/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py @@ -190,7 +190,7 @@ def _instrument(self, **kwargs): name="system.cpu.time", callbacks=[self._get_system_cpu_time], description="System CPU time", - unit="seconds", + unit="s", ) if "system.cpu.utilization" in self._config: @@ -206,7 +206,7 @@ def _instrument(self, **kwargs): name="system.memory.usage", callbacks=[self._get_system_memory_usage], description="System memory usage", - unit="bytes", + unit="By", ) if "system.memory.utilization" in self._config: @@ -257,7 +257,7 @@ def _instrument(self, **kwargs): name="system.disk.io", callbacks=[self._get_system_disk_io], description="System disk IO", - unit="bytes", + unit="By", ) if "system.disk.operations" in self._config: @@ -273,7 +273,7 @@ def _instrument(self, **kwargs): name="system.disk.time", callbacks=[self._get_system_disk_time], description="System disk time", - unit="seconds", + unit="s", ) # TODO Add _get_system_filesystem_usage @@ -282,7 +282,7 @@ def _instrument(self, **kwargs): # callback=self._get_system_filesystem_usage, # name="system.filesystem.usage", # description="System filesystem usage", - # unit="bytes", + # unit="By", # value_type=int, # ) @@ -327,7 +327,7 @@ def _instrument(self, **kwargs): name="system.network.io", callbacks=[self._get_system_network_io], description="System network io", - unit="bytes", + unit="By", ) if "system.network.connections" in self._config: @@ -350,7 +350,7 @@ def _instrument(self, **kwargs): name=f"process.runtime.{self._python_implementation}.memory", callbacks=[self._get_runtime_memory], description=f"Runtime {self._python_implementation} memory", - unit="bytes", + unit="By", ) if "process.runtime.cpu.time" in self._config: @@ -358,7 +358,7 @@ def _instrument(self, **kwargs): name=f"process.runtime.{self._python_implementation}.cpu_time", callbacks=[self._get_runtime_cpu_time], description=f"Runtime {self._python_implementation} CPU time", - unit="seconds", + unit="s", ) if "process.runtime.gc_count" in self._config: