Skip to content

Commit a64bbcc

Browse files
nicohrubecclaude
andcommitted
ref(vercel-ai)!: Move Vercel AI integration to @sentry/server-utils
Move the Vercel AI gen-ai instrumentation from `@sentry/core` to `@sentry/server-utils/src/ai/vercel-ai`, consuming the shared `ai/core` base. This is the last provider move. The public helpers (`addVercelAiProcessors`, `getProviderMetadataAttributes`) and the `_INTERNAL_*` tool-call-context symbols are re-exported from `@sentry/server-utils`; cloudflare/deno/vercel-edge consume them from there, so the platform SDK public API is unchanged. The existing `src/vercel-ai/` diagnostics-channel subscriber layer now imports the moved provider code from `../ai/vercel-ai` and `../ai/core/utils` instead of `@sentry/core`. With both vercel-ai and workers-ai now in server-utils, vercel-ai re-couples to `../workers-ai/constants` directly (the temporary inline in core's copy is gone with the deleted file). As with the other providers, `vercel-edge` re-exports from `@sentry/server-utils/no-diagnostic-channels` to keep the edge build free of `node:diagnostics_channel`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 71328de commit a64bbcc

23 files changed

Lines changed: 151 additions & 73 deletions

File tree

dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v4/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
GEN_AI_USAGE_OUTPUT_TOKENS,
1717
GEN_AI_USAGE_TOTAL_TOKENS,
1818
} from '@sentry/conventions/attributes';
19-
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
19+
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes';
2020
import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner';
2121
import { getStringAttributeValue, isOrchestrionEnabled } from '../../../../utils';
2222

dev-packages/node-integration-tests/suites/tracing/vercelai/span-streaming-v6/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
GEN_AI_USAGE_OUTPUT_TOKENS,
1717
GEN_AI_USAGE_TOTAL_TOKENS,
1818
} from '@sentry/conventions/attributes';
19-
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
19+
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes';
2020
import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner';
2121
import { isOrchestrionEnabled } from '../../../../utils';
2222

dev-packages/node-integration-tests/suites/tracing/vercelai/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
GEN_AI_USAGE_OUTPUT_TOKENS,
2020
GEN_AI_USAGE_TOTAL_TOKENS,
2121
} from '@sentry/conventions/attributes';
22-
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
22+
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../packages/server-utils/src/ai/core/gen-ai-attributes';
2323
import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner';
2424
import { getStringAttributeValue, isOrchestrionEnabled } from '../../../utils';
2525

dev-packages/node-integration-tests/suites/tracing/vercelai/v5/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
GEN_AI_USAGE_OUTPUT_TOKENS,
1717
GEN_AI_USAGE_TOTAL_TOKENS,
1818
} from '@sentry/conventions/attributes';
19-
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
19+
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes';
2020
import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../../utils/runner';
2121
import { getStringAttributeValue, isOrchestrionEnabled } from '../../../../utils';
2222

dev-packages/node-integration-tests/suites/tracing/vercelai/v6_v7/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
GEN_AI_USAGE_OUTPUT_TOKENS,
2222
GEN_AI_USAGE_TOTAL_TOKENS,
2323
} from '@sentry/conventions/attributes';
24-
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/core/src/tracing/ai/gen-ai-attributes';
24+
import { GEN_AI_TOOL_CALL_ID_ATTRIBUTE } from '../../../../../../packages/server-utils/src/ai/core/gen-ai-attributes';
2525
import { cleanupChildProcesses, createEsmAndCjsTests, createEsmTests } from '../../../../utils/runner';
2626
import { isOrchestrionEnabled } from '../../../../utils';
2727

packages/cloudflare/src/integrations/tracing/vercelai.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
*/
1010

1111
import type { IntegrationFn } from '@sentry/core';
12-
import { addVercelAiProcessors, defineIntegration, extendIntegration } from '@sentry/core';
13-
import { vercelAiIntegration, type VercelAiOptions } from '@sentry/server-utils';
12+
import { defineIntegration, extendIntegration } from '@sentry/core';
13+
import { addVercelAiProcessors, vercelAiIntegration, type VercelAiOptions } from '@sentry/server-utils';
1414

1515
const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
1616
const inner = vercelAiIntegration(options);

packages/core/src/server-exports.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,4 @@ export type {
5656

5757
// AI instrumentation is only supported in server runtimes, so these exports are kept out of the browser entry to
5858
// avoid shipping the AI tracing code in browser bundles.
59-
export { addVercelAiProcessors, getProviderMetadataAttributes } from './tracing/vercel-ai';
6059
export { getTruncatedJsonString, shouldEnableTruncation, resolveAIRecordingOptions } from './tracing/ai/utils';
61-
export { _INTERNAL_getSpanContextForToolCallId, _INTERNAL_cleanupToolCallSpanContext } from './tracing/vercel-ai/utils';
62-
export { toolCallSpanContextMap as _INTERNAL_toolCallSpanContextMap } from './tracing/vercel-ai/constants';

packages/deno/src/integrations/tracing/vercelai.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
*/
44

55
import type { IntegrationFn } from '@sentry/core';
6-
import { addVercelAiProcessors, defineIntegration, extendIntegration } from '@sentry/core';
7-
import { vercelAiIntegration as serverUtilsVercelAiIntegration, type VercelAiOptions } from '@sentry/server-utils';
6+
import { defineIntegration, extendIntegration } from '@sentry/core';
7+
import {
8+
addVercelAiProcessors,
9+
vercelAiIntegration as serverUtilsVercelAiIntegration,
10+
type VercelAiOptions,
11+
} from '@sentry/server-utils';
812

913
const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
1014
const inner = serverUtilsVercelAiIntegration(options);

packages/server-utils/src/ai/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ export { instrumentGoogleGenAIClient } from './google-genai';
1010
export { instrumentWorkersAiClient } from './workers-ai';
1111
export { createLangChainCallbackHandler, instrumentLangChainEmbeddings } from './langchain';
1212
export { instrumentStateGraph, instrumentStateGraphCompile, instrumentCreateReactAgent } from './langgraph';
13+
export { addVercelAiProcessors } from './vercel-ai';
File renamed without changes.

0 commit comments

Comments
 (0)