Skip to content

Commit a2a6340

Browse files
mydeabitsandfoxes
authored andcommitted
feat(js): Update docs for vercelAiIntegration (#14168)
This updates the integration docs for vercelAiIntegration: 1. Adds proper docs for next.js, cloudflare - this is waiting on the next release! 2. Ensure it is added on overview pages as well.
1 parent 2b54048 commit a2a6340

17 files changed

+76
-19
lines changed

docs/platforms/javascript/common/configuration/integrations/vercelai.mdx

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ supported:
99
- javascript.express
1010
- javascript.fastify
1111
- javascript.gcp-functions
12+
- javascript.cloudflare
1213
- javascript.hapi
1314
- javascript.hono
1415
- javascript.koa
@@ -27,22 +28,21 @@ supported:
2728

2829
<Alert>
2930

30-
This integration only works in the Node.js and Bun runtimes. Requires SDK version `9.30.0` or higher.
31+
This integration only works in the Node.js, Cloudflare Workers, Vercel Edge Functions and Bun runtimes. Requires SDK version `9.33.0` or higher.
3132

3233
</Alert>
3334

34-
<PlatformSection supported={["javascript.nextjs"]}>
35-
36-
<Include name="nextjs-server-only" />
37-
38-
</PlatformSection>
39-
4035
_Import name: `Sentry.vercelAIIntegration`_
4136

42-
The `vercelAIIntegration` adds instrumentation for the [`ai`](https://www.npmjs.com/package/ai) SDK by Vercel to capture spans using the [`AI SDK's built-in Telemetry`](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry). Get started with the following snippet:
37+
The `vercelAIIntegration` adds instrumentation for the [`ai`](https://www.npmjs.com/package/ai) SDK by Vercel to capture spans using the [`AI SDK's built-in Telemetry`](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).
38+
39+
<PlatformSection notSupported={["javascript.cloudflare", "javascript.nextjs"]}>
40+
It is enabled by default and will automatically capture spans for all `ai`
41+
function calls. You can opt-in to capture inputs and outputs by setting `recordInputs` and `recordOutputs` in the integration config:
4342

4443
```javascript
4544
Sentry.init({
45+
dsn: "____PUBLIC_DSN____"
4646
tracesSampleRate: 1.0,
4747
integrations: [
4848
Sentry.vercelAIIntegration({
@@ -53,17 +53,51 @@ Sentry.init({
5353
});
5454
```
5555

56+
</PlatformSection>
57+
58+
<PlatformSection supported={['javascript.cloudflare']}>
59+
This integration is not enabled by default. You need to manually enable it by passing `Sentry.vercelAIIntegration()` to `Sentry.init`:
60+
61+
```javascript
62+
Sentry.init({
63+
dsn: "____PUBLIC_DSN____"
64+
tracesSampleRate: 1.0,
65+
integrations: [Sentry.vercelAIIntegration()],
66+
});
67+
```
68+
69+
</PlatformSection>
70+
71+
<PlatformSection supported={['javascript.nextjs']}>
72+
This integration is enabled by default in the Node runtime, but not in the Edge runtime. You need to manually enable it by passing `Sentry.vercelAIIntegration()` to `Sentry.init` in your `sentry.edge.config.js` file:
73+
74+
```javascript {filename: 'sentry.edge.config.(js|ts)'}
75+
Sentry.init({
76+
dsn: "____PUBLIC_DSN____"
77+
tracesSampleRate: 1.0,
78+
integrations: [Sentry.vercelAIIntegration()],
79+
});
80+
```
81+
82+
</PlatformSection>
83+
84+
<PlatformSection supported={['javascript.cloudflare', 'javascript.nextjs']}>
5685
To correctly capture spans, pass the `experimental_telemetry` object with `isEnabled: true` to every `generateText`, `generateObject`, and `streamText` function call. For more details, see the [AI SDK Telemetry Metadata docs](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry#telemetry-metadata).
5786

5887
```javascript
5988
const result = await generateText({
6089
model: openai("gpt-4o"),
6190
experimental_telemetry: {
6291
isEnabled: true,
92+
recordInputs: true,
93+
recordOutputs: true,
6394
},
6495
});
6596
```
6697

98+
</PlatformSection>
99+
100+
<PlatformSection notSupported={['javascript.cloudflare']}>
67101
## Options
68102

69103
### `force`
@@ -82,6 +116,12 @@ Sentry.init({
82116
});
83117
```
84118

119+
<PlatformSection supported={["javascript.nextjs"]}>
120+
This option is not available in the Edge runtime. There, the integration is
121+
forced when it is enabled.
122+
</PlatformSection>
123+
124+
<PlatformSection notSupported={['javascript.nextjs']}>
85125
### `recordInputs`
86126

87127
Requires SDK version `9.27.0` or higher.
@@ -114,6 +154,10 @@ Sentry.init({
114154
});
115155
```
116156

157+
</PlatformSection>
158+
159+
</PlatformSection>
160+
117161
## Identifying functions
118162

119163
In order to make it easier to correlate captured spans with the function calls we recommend setting `functionId` in `experimental_telemetry` in all generation function calls:

docs/product/insights/agents/getting-started.mdx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ The Sentry JavaScript SDK supports AI agent monitoring through the Vercel AI int
8181
label="Connect"
8282
url="/platforms/javascript/guides/connect/configuration/integrations/vercelai/"
8383
/>
84+
- <LinkWithPlatformIcon
85+
platform="javascript.cloudflare"
86+
label="Cloudflare"
87+
url="/platforms/javascript/guides/cloudflare/configuration/integrations/vercelai/"
88+
/>
8489
- <LinkWithPlatformIcon
8590
platform="javascript.hono"
8691
label="Hono"
@@ -114,8 +119,6 @@ The Sentry JavaScript SDK supports AI agent monitoring through the Vercel AI int
114119

115120
#### Quick Start with Vercel AI SDK
116121

117-
<Include name="nextjs-server-only" />
118-
119122
```javascript
120123
import { Sentry } from "@sentry/node";
121124

includes/nextjs-server-only.mdx

Lines changed: 0 additions & 5 deletions
This file was deleted.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Depending on whether an integration enhances the functionality of a particular r
2222
### Browser Integrations
2323

2424
| | **Auto Enabled** | **Errors** | **Tracing** | **Replay** | **Additional Context** |
25-
|-------------------------------------------------------|:----------------:|:----------:|:-----------:|:----------:|:----------------------:|
25+
| ----------------------------------------------------- | :--------------: | :--------: | :---------: | :--------: | :--------------------: |
2626
| [`breadcrumbsIntegration`](./breadcrumbs) || | | ||
2727
| [`browserApiErrorsIntegration`](./browserapierrors) ||| | | |
2828
| [`browserSessionIntegration`](./browsersession) || | | ||
@@ -72,6 +72,7 @@ Depending on whether an integration enhances the functionality of a particular r
7272
| [`childProcessIntegration`](./childProcess) || | ||
7373
| [`dataloaderIntegration`](./dataloader) || || |
7474
| [`prismaIntegration`](./prisma) || || |
75+
| [`vercelAiIntegration`](./vercelai) || || |
7576
| [`anrIntegration`](./anr) | || | |
7677
| [`extraErrorDataIntegration`](./extraerrordata) | | | ||
7778
| [`fsIntegration`](./fs) | | || |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
| [`onUncaughtExceptionIntegration`](./onuncaughtexception) ||| | |
1818
| [`onUnhandledRejectionIntegration`](./unhandledrejection) ||| | |
1919
| [`childProcessIntegration`](./childProcess) || | ||
20+
| [`vercelAiIntegration`](./vercelai) || || |
2021
| [`amqplibIntegration`](./amqplib) | | || |
2122
| [`anrIntegration`](./anr) | || | |
2223
| [`captureConsoleIntegration`](./captureconsole) | | | ||

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
| [`requestDataIntegration`](./requestdata) || || |
3030
| [`tediousIntegration`](./tedious) || || |
3131
| [`prismaIntegration`](./prisma) || || |
32+
| [`vercelAiIntegration`](./vercelai) || || |
3233
| [`captureConsoleIntegration`](./captureconsole) | | | ||
3334
| [`dataloaderIntegration`](./dataloader) | | || |
3435
| [`extraErrorDataIntegration`](./extraerrordata) | | | ||

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
| [`tediousIntegration`](./tedious) || || |
3131
| [`childProcessIntegration`](./childProcess) || | ||
3232
| [`rewriteFramesIntegration`](./rewriteframes) ||| | |
33+
| [`vercelAiIntegration`](./vercelai) || || |
3334
| [`anrIntegration`](./anr) | || | |
3435
| [`captureConsoleIntegration`](./captureconsole) | | | ||
3536
| [`dataloaderIntegration`](./dataloader) | | || |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
| [`tediousIntegration`](./tedious) || || |
3131
| [`childProcessIntegration`](./childProcess) || | ||
3232
| [`prismaIntegration`](./prisma) || || |
33+
| [`vercelAiIntegration`](./vercelai) || || |
3334
| [`anrIntegration`](./anr) | || | |
3435
| [`captureConsoleIntegration`](./captureconsole) | | | ||
3536
| [`dataloaderIntegration`](./dataloader) | | || |

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
| [`onUncaughtExceptionIntegration`](./onuncaughtexception) ||| | |
1818
| [`onUnhandledRejectionIntegration`](./unhandledrejection) ||| | |
1919
| [`childProcessIntegration`](./childProcess) || | ||
20+
| [`vercelAiIntegration`](./vercelai) || || |
2021
| [`amqplibIntegration`](./amqplib) | | || |
2122
| [`anrIntegration`](./anr) | || | |
2223
| [`captureConsoleIntegration`](./captureconsole) | | | ||
@@ -40,4 +41,4 @@
4041
| [`requestDataIntegration`](./requestdata) | | || |
4142
| [`rewriteFramesIntegration`](./rewriteframes) | || | |
4243
| [`tediousIntegration`](./tedious) | | || |
43-
| [`trpcMiddleware`](./trpc) | ||||
44+
| [`trpcMiddleware`](./trpc) | ||||

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
| [`tediousIntegration`](./tedious) || || |
3131
| [`childProcessIntegration`](./childProcess) || | ||
3232
| [`prismaIntegration`](./prisma) || || |
33+
| [`vercelAiIntegration`](./vercelai) || || |
3334
| [`anrIntegration`](./anr) | || | |
3435
| [`captureConsoleIntegration`](./captureconsole) | | | ||
3536
| [`dataloaderIntegration`](./dataloader) | | || |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
| [`tediousIntegration`](./tedious) || || |
3131
| [`childProcessIntegration`](./childProcess) || | ||
3232
| [`prismaIntegration`](./prisma) || || |
33+
| [`vercelAiIntegration`](./vercelai) || || |
3334
| [`anrIntegration`](./anr) | || | |
3435
| [`captureConsoleIntegration`](./captureconsole) | | | ||
3536
| [`dataloaderIntegration`](./dataloader) | | || |

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Depending on whether an integration enhances the functionality of a particular r
2222
### Browser Integrations
2323

2424
| | **Auto Enabled** | **Errors** | **Tracing** | **Replay** | **Additional Context** |
25-
|-------------------------------------------------------|:----------------:|:----------:|:-----------:|:----------:|:----------------------:|
25+
| ----------------------------------------------------- | :--------------: | :--------: | :---------: | :--------: | :--------------------: |
2626
| [`breadcrumbsIntegration`](./breadcrumbs) || | | ||
2727
| [`browserApiErrorsIntegration`](./browserapierrors) ||| | | |
2828
| [`browserSessionIntegration`](./browsersession) || | | ||
@@ -85,9 +85,11 @@ Depending on whether an integration enhances the functionality of a particular r
8585
| [`localVariablesIntegration`](./localvariables) | || | |
8686
| [`nodeProfilingIntegration`](./nodeprofiling) | | || |
8787
| [`trpcMiddleware`](./trpc) | ||||
88+
| [`vercelAiIntegration`](./vercelai) || |||
8889

8990
### Edge Integrations
9091

9192
| | **Auto Enabled** | **Errors** | **Tracing** | **Additional Context** |
9293
| --------------------------------------------- | :--------------: | :--------: | :---------: | :--------------------: |
9394
| [`winterCGFetchIntegration`](./wintercgfetch) || |||
95+
| [`vercelAiIntegration`](./vercelai) | | || |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
| [`prismaIntegration`](./prisma) || || |
3737
| [`redisIntegration`](./redis) || || |
3838
| [`requestDataIntegration`](./requestdata) || || |
39+
| [`vercelAiIntegration`](./vercelai) || || |
3940
| [`rewriteFramesIntegration`](./rewriteframes) | || | |
4041
| [`supabaseIntegration`](./supabase) | ||| |
4142
| [`tediousIntegration`](./tedious) || || |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Depending on whether an integration enhances the functionality of a particular r
7171
| [`dataloaderIntegration`](./dataloader) || || |
7272
| [`childProcessIntegration`](./childProcess) || | ||
7373
| [`prismaIntegration`](./prisma) || || |
74+
| [`vercelAiIntegration`](./vercelai) || || |
7475
| [`anrIntegration`](./anr) | || | |
7576
| [`extraErrorDataIntegration`](./extraerrordata) | | | ||
7677
| [`fsIntegration`](./fs) | | || |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Depending on whether an integration enhances the functionality of a particular r
7171
| [`dataloaderIntegration`](./dataloader) || || |
7272
| [`childProcessIntegration`](./childProcess) || | ||
7373
| [`prismaIntegration`](./prisma) || || |
74+
| [`vercelAiIntegration`](./vercelai) || || |
7475
| [`anrIntegration`](./anr) | || | |
7576
| [`extraErrorDataIntegration`](./extraerrordata) | | | ||
7677
| [`fsIntegration`](./fs) | | || |

0 commit comments

Comments
 (0)