{"id":24164,"library":"openinference-instrumentation-vertexai","title":"OpenInference VertexAI Instrumentation","description":"OpenInference instrumentation for Google Vertex AI model calls, enabling tracing and observability via OpenTelemetry. Version 0.1.13 supports Python 3.10-3.13. Actively maintained.","status":"active","version":"0.1.13","language":"python","source_language":"en","source_url":"https://github.com/Arize-AI/openinference/tree/main/python/instrumentation/openinference-instrumentation-vertexai","tags":["observability","tracing","vertex-ai","openinference","opentelemetry"],"install":[{"cmd":"pip install openinference-instrumentation-vertexai","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Uses underscores, not dots, for package name","wrong":"from openinference.instrumentation.vertexai import VertexAIInstrumentor","symbol":"VertexAIInstrumentor","correct":"from openinference_instrumentation_vertexai import VertexAIInstrumentor"}],"quickstart":{"code":"from openinference_instrumentation_vertexai import VertexAIInstrumentor\nfrom opentelemetry import trace\nfrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import SimpleSpanProcessor\nimport vertexai\nimport os\n\n# Set up OpenTelemetry tracing\nprovider = TracerProvider()\nexporter = OTLPSpanExporter(endpoint=os.environ.get('OTEL_EXPORTER_OTLP_ENDPOINT', ''))\nprovider.add_span_processor(SimpleSpanProcessor(exporter))\ntrace.set_tracer_provider(provider)\n\n# Instrument Vertex AI\nVertexAIInstrumentor().instrument()\n\n# Now use Vertex AI normally\nvertexai.init(project=os.environ.get('GOOGLE_CLOUD_PROJECT', ''), location='us-central1')","lang":"python","description":"Initialize OpenTelemetry tracing, instrument Vertex AI with VertexAIInstrumentor, then use Vertex AI normally."},"warnings":[{"fix":"Call VertexAIInstrumentor().instrument() before vertexai.init(...).","message":"Instrumentation must be done before any Vertex AI client calls (e.g., before vertexai.init).","severity":"gotcha","affected_versions":"all"},{"fix":"For async support, consider using the underlying gRPC instrumentation or waiting for future releases.","message":"This instrumentation only captures synchronous calls; async Vertex AI methods (e.g., with asyncio) may not be traced.","severity":"gotcha","affected_versions":"<=0.1.13"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install the package and import with underscores: `pip install openinference-instrumentation-vertexai` and `from openinference_instrumentation_vertexai import VertexAIInstrumentor`.","cause":"Incorrect import path using dots instead of underscores.","error":"ModuleNotFoundError: No module named 'openinference_instrumentation_vertexai'"},{"fix":"Ensure you have set up a TracerProvider with an exporter (e.g., OTLPSpanExporter) and added a span processor before instrumentation.","cause":"Missing or misconfigured OpenTelemetry exporter or span processor.","error":"OpenTelemetry spans not appearing in the backend"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}