Run pyright on Vertex AI instrumentation (#3184)

This commit is contained in:
Aaron Abbott
2025-01-16 14:25:35 -05:00
committed by GitHub
parent a716949d1c
commit 9d9353d4c6
4 changed files with 8 additions and 4 deletions

View File

@ -39,7 +39,7 @@ API
---
"""
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 @@ class VertexAIInstrumentor(BaseInstrumentor):
)
# TODO: implemented in later PR
def _uninstrument(self, **kwargs) -> None:
def _uninstrument(self, **kwargs: Any) -> None:
"""TODO: implemented in later PR"""

View File

@ -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",
]

View File

@ -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