Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PEP 561 to opentelemetry-instrumentation-system-metrics #3132

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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"],
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
Loading