|
8 | 8 | * and users have to manually set this to get spans.
|
9 | 9 | */
|
10 | 10 |
|
11 |
| -import type { Client, IntegrationFn } from '@sentry/core'; |
| 11 | +import type { IntegrationFn } from '@sentry/core'; |
12 | 12 | import { addVercelAiProcessors, defineIntegration } from '@sentry/core';
|
13 |
| -import type { modulesIntegration } from '../modules'; |
14 |
| - |
15 |
| -interface VercelAiOptions { |
16 |
| - /** |
17 |
| - * By default, the instrumentation will register span processors only when the ai package is used. |
18 |
| - * If you want to register the span processors even when the ai package usage cannot be detected, you can set `force` to `true`. |
19 |
| - */ |
20 |
| - force?: boolean; |
21 |
| -} |
22 | 13 |
|
23 | 14 | const INTEGRATION_NAME = 'VercelAI';
|
24 | 15 |
|
25 |
| -/** |
26 |
| - * Determines if the integration should be forced based on environment and package availability. |
27 |
| - * Returns true if the 'ai' package is available. |
28 |
| - */ |
29 |
| -function shouldRunIntegration(client: Client): boolean { |
30 |
| - const modules = client.getIntegrationByName<ReturnType<typeof modulesIntegration>>('Modules'); |
31 |
| - return !!modules?.getModules?.()?.ai; |
32 |
| -} |
33 |
| - |
34 |
| -const _vercelAIIntegration = ((options: VercelAiOptions = {}) => { |
| 16 | +const _vercelAIIntegration = (() => { |
35 | 17 | return {
|
36 | 18 | name: INTEGRATION_NAME,
|
37 |
| - options, |
38 | 19 | setup(client) {
|
39 |
| - if (options.force || shouldRunIntegration(client)) { |
40 |
| - addVercelAiProcessors(client); |
41 |
| - } |
| 20 | + addVercelAiProcessors(client); |
42 | 21 | },
|
43 | 22 | };
|
44 | 23 | }) satisfies IntegrationFn;
|
45 | 24 |
|
46 | 25 | /**
|
47 | 26 | * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.
|
| 27 | + * This integration is not enabled by default, you need to manually add it. |
48 | 28 | *
|
49 | 29 | * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).
|
50 | 30 | *
|
51 |
| - * The integration automatically detects when to force registration |
52 |
| - * when the 'ai' package is available. You can still manually set the `force` option if needed. |
53 |
| - * |
54 |
| - * Unlike the Vercel AI integration in the node SDK, this integration does not add tracing support to |
55 |
| - * `ai` function calls. You need to enable collecting spans for a specific call by setting |
| 31 | + * You need to enable collecting spans for a specific call by setting |
56 | 32 | * `experimental_telemetry.isEnabled` to `true` in the first argument of the function call.
|
57 | 33 | *
|
58 | 34 | * ```javascript
|
|
0 commit comments