From d2ae60fd9c5ee37dc7ef07e47f8411aff491d177 Mon Sep 17 00:00:00 2001 From: Aaron Abbott Date: Wed, 15 Jan 2025 23:25:57 +0000 Subject: [PATCH] Run pyright on Vertex AI instrumentation --- .../src/opentelemetry/instrumentation/vertexai/__init__.py | 6 +++--- .../src/opentelemetry/instrumentation/vertexai/py.typed | 0 pyproject.toml | 5 ++++- tox.ini | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/py.typed diff --git a/instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/__init__.py b/instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/__init__.py index b2011513a9..9437184ff0 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/__init__.py +++ b/instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/__init__.py @@ -39,7 +39,7 @@ --- """ -from typing import Collection +from typing import Any, Collection from opentelemetry._events import get_event_logger from opentelemetry.instrumentation.instrumentor import BaseInstrumentor @@ -52,7 +52,7 @@ class VertexAIInstrumentor(BaseInstrumentor): def instrumentation_dependencies(self) -> Collection[str]: return _instruments - def _instrument(self, **kwargs): + def _instrument(self, **kwargs: Any): """Enable VertexAI instrumentation.""" tracer_provider = kwargs.get("tracer_provider") _tracer = get_tracer( @@ -70,5 +70,5 @@ def _instrument(self, **kwargs): ) # TODO: implemented in later PR - def _uninstrument(self, **kwargs) -> None: + def _uninstrument(self, **kwargs: Any) -> None: """TODO: implemented in later PR""" diff --git a/instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/py.typed b/instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pyproject.toml b/pyproject.toml index 6ba2e933c3..c023fc549f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,10 +48,13 @@ pythonVersion = "3.8" reportPrivateUsage = false # Ignore private attributes added by instrumentation packages. # Add progressively instrumentation packages here. include = [ - "instrumentation/opentelemetry-instrumentation-threading/**/*.py" + "instrumentation/opentelemetry-instrumentation-threading/**/*.py", + "instrumentation-genai/opentelemetry-instrumentation-vertexai/**/*.py", ] # We should also add type hints to the test suite - It helps on finding bugs. # We are excluding for now because it's easier, and more important to add to the instrumentation packages. exclude = [ "instrumentation/opentelemetry-instrumentation-threading/tests/**", + "instrumentation-genai/opentelemetry-instrumentation-vertexai/tests/**/*.py", + "instrumentation-genai/opentelemetry-instrumentation-vertexai/examples/**/*.py", ] diff --git a/tox.ini b/tox.ini index feeda77702..13dd9fafb6 100644 --- a/tox.ini +++ b/tox.ini @@ -994,5 +994,6 @@ deps = {[testenv]test_deps} {toxinidir}/opentelemetry-instrumentation {toxinidir}/util/opentelemetry-util-http + {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-vertexai[instruments] commands = pyright