diff --git a/instrumentation-genai/opentelemetry-instrumentation-vertexai-v2/tests/conftest.py b/instrumentation-genai/opentelemetry-instrumentation-vertexai-v2/tests/conftest.py index 095cda2d75..938485442c 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-vertexai-v2/tests/conftest.py +++ b/instrumentation-genai/opentelemetry-instrumentation-vertexai-v2/tests/conftest.py @@ -1,11 +1,14 @@ """Unit tests configuration module.""" -from os import replace import re from typing import Any, Mapping, MutableMapping import pytest +import vertexai from google.auth.credentials import AnonymousCredentials +from vcr import VCR +from vcr.record_mode import RecordMode +from vcr.request import Request from opentelemetry import trace from opentelemetry.instrumentation.vertexai_v2 import VertexAIInstrumentor @@ -17,11 +20,6 @@ pytest_plugins = [] -import vertexai -from vcr import VCR -from vcr.record_mode import RecordMode -from vcr.request import Request - @pytest.fixture(scope="session") def exporter(): @@ -81,7 +79,7 @@ def filter_headers(headers: Mapping[str, str]) -> Mapping[str, str]: def before_record_cb(request: Request): request.headers = filter_headers(request.headers) request.uri = re.sub( - r"/projects/[^/]+/", f"/projects/fake-project/", request.uri + r"/projects/[^/]+/", "/projects/fake-project/", request.uri ) return request diff --git a/instrumentation-genai/opentelemetry-instrumentation-vertexai-v2/tests/test_gemini.py b/instrumentation-genai/opentelemetry-instrumentation-vertexai-v2/tests/test_gemini.py index e7b475d787..59ae91cccf 100644 --- a/instrumentation-genai/opentelemetry-instrumentation-vertexai-v2/tests/test_gemini.py +++ b/instrumentation-genai/opentelemetry-instrumentation-vertexai-v2/tests/test_gemini.py @@ -7,7 +7,7 @@ @pytest.mark.vcr def test_vertexai_generate_content(exporter): multimodal_model = GenerativeModel("gemini-pro-vision") - response = multimodal_model.generate_content( + multimodal_model.generate_content( [ Part.from_uri( "gs://generativeai-downloads/images/scones.jpg", diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index a292299d70..0dffd10c24 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -20,6 +20,10 @@ "library": "openai >= 1.26.0", "instrumentation": "opentelemetry-instrumentation-openai-v2==2.1b0.dev", }, + { + "library": "google-cloud-aiplatform >= 1.64", + "instrumentation": "opentelemetry-instrumentation-vertexai-v2==2.1b0.dev", + }, { "library": "aio_pika >= 7.2.0, < 10.0.0", "instrumentation": "opentelemetry-instrumentation-aio-pika==0.50b0.dev",