Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/cloudflare/src/integrations/tracing/vercelai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ interface VercelAiOptions {
* Defaults to `true`.
*/
enableTruncation?: boolean;

// `recordInputs`/`recordOutputs` are intentionally omitted: this entrypoint only post-processes
// spans the AI SDK already emitted, so it cannot decide whether inputs/outputs are recorded.
// Control this per call via `experimental_telemetry.recordInputs`/`recordOutputs`, or use the
// `@sentry/cloudflare/nodejs_compat` entrypoint for integration-level control on ai >= 7.
}

const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,9 @@

import type { IntegrationFn } from '@sentry/core';
import { defineIntegration } from '@sentry/core';
import { vercelAiIntegration as serverUtilsVercelAiIntegration } from '@sentry/server-utils';
import { vercelAiIntegration as serverUtilsVercelAiIntegration, type VercelAiOptions } from '@sentry/server-utils';
import { vercelAIIntegration as cloudflareVercelAIIntegration } from '../../../integrations/tracing/vercelai';

interface VercelAiOptions {
/**
* Enable or disable truncation of recorded input messages.
* Defaults to `true`.
*/
enableTruncation?: boolean;
}

const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
const inner = serverUtilsVercelAiIntegration(options);
const instrumentation = cloudflareVercelAIIntegration(options);
Expand Down
10 changes: 1 addition & 9 deletions packages/deno/src/integrations/tracing/vercelai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@

import type { IntegrationFn } from '@sentry/core';
import { addVercelAiProcessors, defineIntegration, extendIntegration } from '@sentry/core';
import { vercelAiIntegration as serverUtilsVercelAiIntegration } from '@sentry/server-utils';

interface VercelAiOptions {
/**
* Enable or disable truncation of recorded input messages.
* Defaults to `true`.
*/
enableTruncation?: boolean;
}
import { vercelAiIntegration as serverUtilsVercelAiIntegration, type VercelAiOptions } from '@sentry/server-utils';

const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
const inner = serverUtilsVercelAiIntegration(options);
Expand Down
22 changes: 2 additions & 20 deletions packages/node/src/integrations/tracing/vercelai/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Integration } from '@sentry/core';
import type { VercelAiOptions as VercelAiBaseOptions } from '@sentry/server-utils';

/**
* Telemetry configuration.
Expand Down Expand Up @@ -45,31 +46,12 @@ export declare type AttributeValue =
| Array<null | undefined | number>
| Array<null | undefined | boolean>;

export interface VercelAiOptions {
/**
* Enable or disable input recording. Enabled if `dataCollection.genAI.inputs` (or the deprecated `sendDefaultPii` option) is `true`
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.
* Integration-level options take precedence over global `dataCollection` config.
*/
recordInputs?: boolean;
/**
* Enable or disable output recording. Enabled if `dataCollection.genAI.outputs` (or the deprecated `sendDefaultPii` option) is `true`
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.
* Integration-level options take precedence over global `dataCollection` config.
*/
recordOutputs?: boolean;

export interface VercelAiOptions extends VercelAiBaseOptions {
/**
* By default, the instrumentation will register span processors only when the ai package is used.
* If you want to register the span processors even when the ai package usage cannot be detected, you can set `force` to `true`.
*/
force?: boolean;

/**
* Enable or disable truncation of recorded input messages.
* Defaults to `true`.
*/
enableTruncation?: boolean;
}

export interface VercelAiIntegration extends Integration {
Expand Down
2 changes: 1 addition & 1 deletion packages/server-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export type {
TracingChannelBindingHandle,
TracingChannelPayloadWithSpan,
} from './tracing-channel';
export { vercelAiIntegration } from './vercel-ai';
export type { InstrumentationConfig } from './orchestrion';
export { vercelAiIntegration, type VercelAiOptions } from './vercel-ai';
export {
fastifyIntegration,
// oxlint-disable-next-line typescript/no-deprecated
Expand Down
4 changes: 2 additions & 2 deletions packages/server-utils/src/vercel-ai/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineIntegration, waitForTracingChannelBinding, type IntegrationFn } f
import { subscribeVercelAiTracingChannel } from './vercel-ai-dc-subscriber';
import * as dc from 'node:diagnostics_channel';

type VercelAiOptions = {
export interface VercelAiOptions {
/**
* Enable or disable input recording. Enabled if `dataCollection.genAI.inputs` (or the deprecated `sendDefaultPii` option) is `true`
* or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.
Expand All @@ -22,7 +22,7 @@ type VercelAiOptions = {
* Defaults to `true`.
*/
enableTruncation?: boolean;
};
}

const _vercelAiIntegration = ((options: VercelAiOptions = {}) => {
return {
Expand Down
5 changes: 5 additions & 0 deletions packages/vercel-edge/src/integrations/tracing/vercelai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ interface VercelAiOptions {
* Defaults to `true`.
*/
enableTruncation?: boolean;

// `recordInputs`/`recordOutputs` are intentionally omitted: this entrypoint only post-processes
// spans the AI SDK already emitted (no OTel patch or tracing channel in the edge runtime), so it
// cannot decide whether inputs/outputs are recorded. Control this per call via
// `experimental_telemetry.recordInputs`/`recordOutputs`.
}

const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
Expand Down
Loading