Skip to content

Conversation

@RulaKhaled
Copy link
Member

DESCRIBE YOUR PR

Documents Google Gen AI integration

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline: Oct 1st
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

@vercel
Copy link

vercel bot commented Sep 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sentry-docs Ready Ready Preview Comment Oct 2, 2025 4:48pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
develop-docs Ignored Ignored Preview Oct 2, 2025 4:48pm

@codecov
Copy link

codecov bot commented Sep 29, 2025

Bundle Report

Changes will increase total bundle size by 34.12kB (0.15%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-client-array-push 10.13MB -6 bytes (-0.0%) ⬇️
sentry-docs-server-cjs 12.92MB 34.12kB (0.26%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 882.71kB -0.0%
static/chunks/8321-*.js -3 bytes 425.87kB -0.0%
static/9_XhhGCrPNywoA_ezRTrV/_buildManifest.js (New) 684 bytes 684 bytes 100.0% 🚀
static/9_XhhGCrPNywoA_ezRTrV/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/0JCe0pMUfu609x3obILs5/_buildManifest.js (Deleted) -684 bytes 0 bytes -100.0% 🗑️
static/0JCe0pMUfu609x3obILs5/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.78MB -0.0%
../instrumentation.js -3 bytes 1.1MB -0.0%
9523.js -3 bytes 1.08MB -0.0%
../app/[[...path]]/page.js.nft.json 11.38kB 845.79kB 1.36%
../app/platform-redirect/page.js.nft.json 11.38kB 845.7kB 1.36%
../app/sitemap.xml/route.js.nft.json 11.38kB 842.93kB 1.37%

</PlatformLink>
- <PlatformLink to="/configuration/integrations/openai/">OpenAI</PlatformLink>
- <PlatformLink to="/configuration/integrations/anthropic/">Anthropic</PlatformLink>
- <PlatformLink to="/configuration/integrations/anthropic">Anthropic</PlatformLink>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Not sure if this was intended, but this one is now missing a trailing slash

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had some suggestions and questions but nothing totally blocking. Happy to leave everything up to you but maybe we can just get some clarification on the nextjs section.

Comment on lines 29 to 32
## Supported Versions

- `@google/genai`: `>=0.10.0 <2`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: I'd probably move this down beneath the intro section because otherwise, the intro paragraph belongs to the "Supported Versions" heading

Comment on lines +68 to +69
const genAI = new GoogleGenAI(process.env.API_KEY);
const client = Sentry.instrumentGoogleGenAIClient(genAI, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super-l: General question (not just this snippet) Is client also mentioned by the regular google documentation for how to use the library? if they use a different common name, I'd rather go with that, just to keep things familiar for users.

Maybe this

Suggested change
const genAI = new GoogleGenAI(process.env.API_KEY);
const client = Sentry.instrumentGoogleGenAIClient(genAI, {
const originialGenAI = new GoogleGenAI(process.env.API_KEY);
const genAI = Sentry.instrumentGoogleGenAIClient(originialGenAI, {

or

Suggested change
const genAI = new GoogleGenAI(process.env.API_KEY);
const client = Sentry.instrumentGoogleGenAIClient(genAI, {
const genAI = new GoogleGenAI(process.env.API_KEY);
const instrumentedGenAi = Sentry.instrumentGoogleGenAIClient(genAI, {

happy to go with whatever makes most sense. If client is that, then no need to change anything 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They use ai https://www.npmjs.com/package/@google/genai (which i'd rather not use because Vercel's package is ai) andclient https://googleapis.github.io/python-genai/ interchangeably, but mos actually refer to ai as client!


The `googleGenAIIntegration` adds instrumentation for the `@google/genai` SDK to capture spans by automatically wrapping Google Gen AI client calls and recording LLM interactions with configurable input/output recording.

<PlatformSection notSupported={["javascript.cloudflare", "javascript.nextjs"]}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this section also be visible for Next.JS? IIUC only the edge runtime needs the other setup?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for edge runtime, we are handling this down in a <PlatformSection supported={['javascript.nextjs']}> section

import * as Sentry from "@sentry/cloudflare";
import { GoogleGenAI } from "@google/genai";

const genAI = new GoogleGenAI(process.env.API_KEY);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect Environment Variable Access in Code Examples

The code examples for Cloudflare Workers and Next.js Edge runtime incorrectly use process.env.API_KEY. These environments have restricted or different mechanisms for accessing environment variables, so process.env isn't the correct approach here.

Additional Locations (1)

Fix in Cursor Fix in Web

@RulaKhaled RulaKhaled merged commit 720834b into master Oct 2, 2025
13 checks passed
@RulaKhaled RulaKhaled deleted the add-google-genai-docs branch October 2, 2025 17:40
@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants