Skip to content

Commit 5190b96

Browse files
authored
Merge branch 'master' into lazar-ignore-spans-examples
2 parents 9641a8f + 720834b commit 5190b96

File tree

18 files changed

+159
-2
lines changed

18 files changed

+159
-2
lines changed
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
---
2+
title: Google Gen AI
3+
description: "Adds instrumentation for Google Gen AI SDK."
4+
supported:
5+
- javascript.node
6+
- javascript.aws-lambda
7+
- javascript.azure-functions
8+
- javascript.connect
9+
- javascript.express
10+
- javascript.fastify
11+
- javascript.gcp-functions
12+
- javascript.hapi
13+
- javascript.hono
14+
- javascript.koa
15+
- javascript.nestjs
16+
- javascript.electron
17+
- javascript.nextjs
18+
- javascript.nuxt
19+
- javascript.solidstart
20+
- javascript.sveltekit
21+
- javascript.react-router
22+
- javascript.remix
23+
- javascript.astro
24+
- javascript.bun
25+
- javascript.tanstackstart-react
26+
- javascript.cloudflare
27+
---
28+
29+
<Alert>
30+
31+
This integration works in the Node.js, Cloudflare Workers, and Vercel Edge Functions runtimes. It requires SDK version `10.14.0` or higher.
32+
33+
</Alert>
34+
35+
_Import name: `Sentry.googleGenAIIntegration`_
36+
37+
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.
38+
39+
<PlatformSection notSupported={["javascript.cloudflare", "javascript.nextjs"]}>
40+
It is enabled by default and will automatically capture spans for Google Gen AI SDK method calls. You can opt-in to capture inputs and outputs by setting `recordInputs` and `recordOutputs` in the integration config:
41+
42+
```javascript
43+
Sentry.init({
44+
dsn: "____PUBLIC_DSN____",
45+
tracesSampleRate: 1.0,
46+
integrations: [
47+
Sentry.googleGenAIIntegration({
48+
recordInputs: true,
49+
recordOutputs: true,
50+
}),
51+
],
52+
});
53+
```
54+
55+
</PlatformSection>
56+
57+
<PlatformSection supported={["javascript.cloudflare"]}>
58+
For Cloudflare Workers, you need to manually instrument the Google Gen AI client using the `instrumentGoogleGenAIClient` helper:
59+
60+
```javascript
61+
import * as Sentry from "@sentry/cloudflare";
62+
import { GoogleGenAI } from "@google/genai";
63+
64+
const genAI = new GoogleGenAI(process.env.API_KEY);
65+
const client = Sentry.instrumentGoogleGenAIClient(genAI, {
66+
recordInputs: true,
67+
recordOutputs: true,
68+
});
69+
70+
// Use the wrapped client instead of the original genAI instance
71+
const result = await client.models.generateContent("Hello!");
72+
```
73+
74+
</PlatformSection>
75+
76+
<PlatformSection supported={['javascript.nextjs']}>
77+
78+
This integration is automatically instrumented in the Node.js runtime. For Next.js applications using the Edge runtime, you need to manually instrument the Google Gen AI client:
79+
80+
```javascript
81+
import * as Sentry from "@sentry/nextjs";
82+
import { GoogleGenAI } from "@google/genai";
83+
84+
const genAI = new GoogleGenAI(process.env.API_KEY);
85+
const client = Sentry.instrumentGoogleGenAIClient(genAI, {
86+
recordInputs: true,
87+
recordOutputs: true,
88+
});
89+
90+
// Use the wrapped client instead of the original genAI instance
91+
const result = await client.models.generateContent("Hello!");
92+
```
93+
94+
</PlatformSection>
95+
96+
## Options
97+
98+
### `recordInputs`
99+
100+
_Type: `boolean`_
101+
102+
Records inputs to Google Gen AI SDK method calls (such as prompts and messages).
103+
104+
Defaults to `true` if `sendDefaultPii` is `true`.
105+
106+
```javascript
107+
Sentry.init({
108+
integrations: [Sentry.googleGenAIIntegration({ recordInputs: true })],
109+
});
110+
```
111+
112+
### `recordOutputs`
113+
114+
_Type: `boolean`_
115+
116+
Records outputs from Google Gen AI SDK method calls (such as generated text and responses).
117+
118+
Defaults to `true` if `sendDefaultPii` is `true`.
119+
120+
```javascript
121+
Sentry.init({
122+
integrations: [Sentry.googleGenAIIntegration({ recordOutputs: true })],
123+
});
124+
```
125+
126+
## Configuration
127+
128+
By default this integration adds tracing support to Google Gen AI SDK method calls including:
129+
130+
- `models.generateContent()` - Make an API request to generate content with a given model.
131+
- `models.generateContentStream()` - Make an API request to generate content with a given model and yields the response in chunks.
132+
- `chats.create()` - Create chat sessions.
133+
- `sendMessage()` - Send messages in chat sessions.
134+
- `sendMessageStream()` - Stream messages in chat sessions.
135+
136+
The integration will automatically detect streaming vs non-streaming requests and handle them appropriately.
137+
138+
## Supported Versions
139+
140+
- `@google/genai`: `>=0.10.0 <2`

docs/platforms/javascript/common/tracing/instrumentation/ai-agents-module.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The JavaScript SDK supports automatic instrumentation for some AI libraries. We
3939
</PlatformLink>
4040
- <PlatformLink to="/configuration/integrations/openai/">OpenAI</PlatformLink>
4141
- <PlatformLink to="/configuration/integrations/anthropic/">Anthropic</PlatformLink>
42+
- <PlatformLink to="/configuration/integrations/google-genai/">Google Gen AI SDK</PlatformLink>
4243

4344
## Manual Instrumentation
4445

-2.85 KB
Loading

docs/product/user-feedback/index.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,17 @@ You can narrow down the results in the feedback list by using the project, envir
5151

5252
![User Feedback List.](./img/user-feedback-list.png)
5353

54-
## AI-Powered User Feedback Summaries
54+
## AI-Powered User Feedback Summaries
5555

5656
Sentry now provides **AI-powered user feedback summaries** that automatically analyze your feedback to give you actionable insights at a glance. This at-a-glance summary can help you understand large amounts of user feedback without having to manually triage every piece of feedback, transforming overwhelming volume into actionable insights, and helping you prioritize user experience improvements.
5757

5858
### How It Works
5959

60-
At the top of the User Feedback index, you'll see a summary highlighting your users' most common sentiments across the project(s) and date range you've selected. The summary provides a concise overview of what users are saying about your product:
60+
At the top of the User Feedback index, you'll see a summary highlighting your users' most common sentiments across the project(s) and date range you've selected. The summary provides a concise overview of what users are saying about your product. The summary also provides AI-generated categories that you can click to filter the feedback. The filtered list will then show contextually relevant feedback; for example, feedback related to your app's "performance".
6161

62+
<div style={{width: '550px'}}>
6263
![AI User Feedback Summary.](./img/ai-feedback-summary.png)
64+
</div>
6365

6466
## Triaging User Feedback Submissions
6567

platform-includes/configuration/integrations/javascript.astro.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@ Depending on whether an integration enhances the functionality of a particular r
8383
| [`trpcMiddleware`](./trpc) | ||||
8484
| [`openAIIntegration`](./openai) || || |
8585
| [`anthropicAIIntegration`](./anthropic) |||| |
86+
| [`googleGenAIIntegration`](./google-genai) |||| |
8687
| [`zodErrorsIntegration`](./zodErrors) | | | ||

platform-includes/configuration/integrations/javascript.aws-lambda.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| [`vercelAiIntegration`](./vercelai) || || |
2121
| [`openAIIntegration`](./openai) || || |
2222
| [`anthropicAIIntegration`](./anthropic) |||| |
23+
| [`googleGenAIIntegration`](./google-genai) |||| |
2324
| [`amqplibIntegration`](./amqplib) | | || |
2425
| [`anrIntegration`](./anr) | || | |
2526
| [`captureConsoleIntegration`](./captureconsole) | | | ||

platform-includes/configuration/integrations/javascript.bun.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
| [`vercelAiIntegration`](./vercelai) || || |
3333
| [`openAIIntegration`](./openai) || || |
3434
| [`anthropicAIIntegration`](./anthropic) |||| |
35+
| [`googleGenAIIntegration`](./google-genai) |||| |
3536
| [`captureConsoleIntegration`](./captureconsole) | | | ||
3637
| [`dataloaderIntegration`](./dataloader) | | || |
3738
| [`extraErrorDataIntegration`](./extraerrordata) | | | ||

platform-includes/configuration/integrations/javascript.connect.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
| [`vercelAiIntegration`](./vercelai) || || |
3434
| [`openAIIntegration`](./openai) || || |
3535
| [`anthropicAIIntegration`](./anthropic) |||| |
36+
| [`googleGenAIIntegration`](./google-genai) |||| |
3637
| [`anrIntegration`](./anr) | || | |
3738
| [`captureConsoleIntegration`](./captureconsole) | | | ||
3839
| [`eventLoopBlockIntegration`](./event-loop-block) | || | |

platform-includes/configuration/integrations/javascript.fastify.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
| [`vercelAiIntegration`](./vercelai) || || |
3434
| [`openAIIntegration`](./openai) || || |
3535
| [`anthropicAIIntegration`](./anthropic) |||| |
36+
| [`googleGenAIIntegration`](./google-genai) |||| |
3637
| [`anrIntegration`](./anr) | || | |
3738
| [`captureConsoleIntegration`](./captureconsole) | | | ||
3839
| [`eventLoopBlockIntegration`](./event-loop-block) | || | |

platform-includes/configuration/integrations/javascript.gcp-functions.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| [`vercelAiIntegration`](./vercelai) || || |
2121
| [`openAIIntegration`](./openai) || || |
2222
| [`anthropicAIIntegration`](./anthropic) |||| |
23+
| [`googleGenAIIntegration`](./google-genai) |||| |
2324
| [`amqplibIntegration`](./amqplib) | | || |
2425
| [`anrIntegration`](./anr) | || | |
2526
| [`captureConsoleIntegration`](./captureconsole) | | | ||

0 commit comments

Comments
 (0)