Add instrumentation for Google Vertex AI (@google-cloud/vertexai)

Open
#24,489 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
58/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
google-cloud, nodejs, typescript

Research direction

Start by reading the existing instrumentation under packages/server-utils/src/ai/google-genai/ and the integration wiring in src/integrations/google-genai.ts, then compare the Vertex AI SDK entry points named in the issue. Add the standalone integration under packages/server-utils/src/ai/google-vertexai/, wire it through src/integrations/google-vertexai.ts and getTracingIntegrations(), and cover generation, chat, streaming, model, token, and finish-reason attributes.

Written by the indexing model from the issue text.

Description

Feature javascript Node.js

Add native gen-AI instrumentation for the standalone Google Vertex AI SDK, @google-cloud/vertexai (repo).

Coverage status / why this is a partial gap

Vertex is already reachable two ways today, so this is specifically about the standalone SDK:

  • @google/genai (which we already instrument) can target the Vertex backend via vertexai: true — already covered.
  • @ai-sdk/google-vertex (Vercel AI SDK provider, ~13.6M/mo) — covered by proxy through our vercel-ai integration.
  • @google-cloud/vertexai standalone SDK — not covered. This issue tracks that path.

Relevance (npm)

  • @google-cloud/vertexai: ~4.0M downloads/month (~33.7M last year). Slightly above its trailing-12-month run-rate, though Google is steering users toward the unified @google/genai SDK, so weigh this against the fact that the modern path is already instrumented.

Rough scope

  • Add instrumentation logic under packages/server-utils/src/ai/google-vertexai/ and wire it up via src/integrations/google-vertexai.ts, registered in getTracingIntegrations() (per the AI-integration architecture; runtime packages re-export from @sentry/server-utils).
  • Instrument VertexAI -> getGenerativeModel().generateContent() / generateContentStream() (and chat sessions), plus streaming.
  • Emit gen_ai.* spans following the span attribute conventions (gen_ai.provider.name = google_vertex, request/response model, token usage, finish reasons). Much of the response/attribute shaping likely overlaps with the existing google-genai instrumentation and can be shared.
  • Not OpenAI wire-compatible, so it needs its own instrumentation (can't reuse the openai-compatible shim).
Dominant language
TypeScript
Stars
8.7k
Forks
1.9k
Avg merge
1d 18h
Merged PRs (30d)
543

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsentry/sentry-javascript

All issues in getsentry/sentry-javascript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.