diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e01dbe8bc..2379e08e57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#4139](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4139)) ### Fixed +- `opentelemetry-instrumentation-system-metrics`: Rename deprecated `system.disk.time` metric to `system.disk.operation.time` per updated semantic conventions. + ([#4248](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4248)) - `opentelemetry-instrumentation-mysql`: Refactor MySQL integration test mocks to use concrete DBAPI connection attributes, reducing noisy attribute type warnings. ([#4116](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/4116)) - `opentelemetry-instrumentation-cassandra`: Use `_instruments_any` instead of `_instruments` for driver dependencies so that having either `cassandra-driver` or `scylla-driver` installed is sufficient 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 810b0a7898..e6c1967efc 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 @@ -29,7 +29,7 @@ "system.swap.utilization": ["used", "free"], "system.disk.io": ["read", "write"], "system.disk.operations": ["read", "write"], - "system.disk.time": ["read", "write"], + "system.disk.operation.time": ["read", "write"], "system.network.dropped.packets": ["transmit", "receive"], "system.network.packets": ["transmit", "receive"], "system.network.errors": ["transmit", "receive"], @@ -131,7 +131,7 @@ "system.swap.utilization": ["used", "free"], "system.disk.io": ["read", "write"], "system.disk.operations": ["read", "write"], - "system.disk.time": ["read", "write"], + "system.disk.operation.time": ["read", "write"], "system.network.dropped.packets": ["transmit", "receive"], "system.network.packets": ["transmit", "receive"], "system.network.errors": ["transmit", "receive"], @@ -332,10 +332,9 @@ def _instrument(self, **kwargs: Any): unit="operations", ) - # FIXME: this has been replaced by system.disk.operation.time - if "system.disk.time" in self._config: + if "system.disk.operation.time" in self._config: self._meter.create_observable_counter( - name="system.disk.time", + name="system.disk.operation.time", callbacks=[self._get_system_disk_time], description="System disk time", unit="s", @@ -710,7 +709,7 @@ def _get_system_disk_time( ) -> Iterable[Observation]: """Observer callback for disk time""" for device, counters in psutil.disk_io_counters(perdisk=True).items(): - for metric in self._config["system.disk.time"]: + for metric in self._config["system.disk.operation.time"]: if hasattr(counters, f"{metric}_time"): self._system_disk_time_labels["device"] = device self._system_disk_time_labels["direction"] = metric @@ -728,7 +727,7 @@ def _get_system_disk_merged( # operations or the value type should be Double for device, counters in psutil.disk_io_counters(perdisk=True).items(): - for metric in self._config["system.disk.time"]: + for metric in self._config["system.disk.operation.time"]: if hasattr(counters, f"{metric}_merged_count"): self._system_disk_merged_labels["device"] = device self._system_disk_merged_labels["direction"] = metric diff --git a/instrumentation/opentelemetry-instrumentation-system-metrics/tests/test_system_metrics.py b/instrumentation/opentelemetry-instrumentation-system-metrics/tests/test_system_metrics.py index 65daae52f4..01190bc0a1 100644 --- a/instrumentation/opentelemetry-instrumentation-system-metrics/tests/test_system_metrics.py +++ b/instrumentation/opentelemetry-instrumentation-system-metrics/tests/test_system_metrics.py @@ -111,7 +111,7 @@ def test_system_metrics_instrument(self): "system.swap.utilization", "system.disk.io", "system.disk.operations", - "system.disk.time", + "system.disk.operation.time", "system.network.dropped_packets", "system.network.packets", "system.network.errors", @@ -511,7 +511,7 @@ def test_system_disk_operations(self, mock_disk_io_counters): self._test_metrics("system.disk.operations", expected) @mock.patch("psutil.disk_io_counters") - def test_system_disk_time(self, mock_disk_io_counters): + def test_system_disk_operation_time(self, mock_disk_io_counters): DiskIO = namedtuple( "DiskIO", [ @@ -562,7 +562,7 @@ def test_system_disk_time(self, mock_disk_io_counters): {"device": "sdb", "direction": "write"}, 14 / 1000 ), ] - self._test_metrics("system.disk.time", expected) + self._test_metrics("system.disk.operation.time", expected) @mock.patch("psutil.net_io_counters") def test_system_network_dropped_packets(self, mock_net_io_counters):