diff --git a/CHANGELOG.md b/CHANGELOG.md index 75178d5b32..de7415b2ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3100](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3100)) - Add support to database stability opt-in in `_semconv` utilities and add tests ([#3111](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3111)) +- `opentelemetry-instrumentation-system-metrics` Add `py.typed` file to enable PEP 561 + ([#3132](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3132)) +- `opentelemetry-opentelemetry-sqlite3` Add `py.typed` file to enable PEP 561 + ([#3133](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3133)) - `opentelemetry-instrumentation-falcon` add support version to v4 ([#3086](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3086)) - add support to Python 3.13 diff --git a/instrumentation/opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3/py.typed b/instrumentation/opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3/py.typed new file mode 100644 index 0000000000..e69de29bb2 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 aff86ea77b..a81c5bf7ff 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 @@ -76,18 +76,18 @@ --- """ +from __future__ import annotations + import gc import logging import os import sys import threading from platform import python_implementation -from typing import Collection, Dict, Iterable, List, Optional +from typing import Any, Collection, Iterable import psutil -# FIXME Remove this pylint disabling line when Github issue is cleared -# pylint: disable=no-name-in-module from opentelemetry.instrumentation.instrumentor import BaseInstrumentor from opentelemetry.instrumentation.system_metrics.package import _instruments from opentelemetry.instrumentation.system_metrics.version import __version__ @@ -96,7 +96,7 @@ _logger = logging.getLogger(__name__) -_DEFAULT_CONFIG = { +_DEFAULT_CONFIG: dict[str, list[str] | None] = { "system.cpu.time": ["idle", "user", "system", "irq"], "system.cpu.utilization": ["idle", "user", "system", "irq"], "system.memory.usage": ["used", "free", "cached"], @@ -129,8 +129,8 @@ class SystemMetricsInstrumentor(BaseInstrumentor): def __init__( self, - labels: Optional[Dict[str, str]] = None, - config: Optional[Dict[str, List[str]]] = None, + labels: dict[str, str] | None = None, + config: dict[str, list[str] | None] | None = None, ): super().__init__() if config is None: @@ -176,7 +176,7 @@ def __init__( def instrumentation_dependencies(self) -> Collection[str]: return _instruments - def _instrument(self, **kwargs): + def _instrument(self, **kwargs: Any): # pylint: disable=too-many-branches meter_provider = kwargs.get("meter_provider") self._meter = get_meter( @@ -408,7 +408,7 @@ def _instrument(self, **kwargs): description="Number of file descriptors in use by the process.", ) - def _uninstrument(self, **__): + def _uninstrument(self, **kwargs: Any): pass def _get_open_file_descriptors( diff --git a/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/py.typed b/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/py.typed new file mode 100644 index 0000000000..e69de29bb2