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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ async function run() {
prompt: 'Where is the first span?',
});

// This span should have input and output prompts attached because telemetry is explicitly enabled.
// This span should have input and output prompts attached because recording is explicitly enabled.
// (v6 enables recording implicitly from `isEnabled: true`; v7's diagnostics channel only carries
// the explicit `recordInputs`/`recordOutputs` flags, so we set them here to exercise both.)
await generateText({
experimental_telemetry: { isEnabled: true },
experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },
model: new MockLanguageModelV3({
doGenerate: async () => ({
finishReason: { unified: 'stop', raw: 'stop' },
Expand Down

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions packages/node/src/integrations/tracing/vercelai/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Client, IntegrationFn } from '@sentry/core';
import { addVercelAiProcessors, defineIntegration } from '@sentry/core';
import { generateInstrumentOnce, type modulesIntegration } from '@sentry/node-core';
import { tracingChannel as otelTracingChannel } from '@sentry/opentelemetry/tracing-channel';
import { subscribeVercelAiTracingChannel } from '@sentry/server-utils';
import { INTEGRATION_NAME } from './constants';
import { SentryVercelAiInstrumentation } from './instrumentation';
import type { VercelAiOptions } from './types';
Expand All @@ -24,6 +26,11 @@ const _vercelAIIntegration = ((options: VercelAiOptions = {}) => {
options,
setupOnce() {
instrumentation = instrumentVercelAi();

// Subscribe to the `ai` SDK's native telemetry tracing channel (ai >= 7).
// This is a no-op on versions that don't publish to the channel, so it is always safe to call.
// The factory needs the Sentry OTel context manager, which `initOpenTelemetry()` registers after `setupOnce`, so defer a tick.
void Promise.resolve().then(() => subscribeVercelAiTracingChannel(otelTracingChannel));
Comment thread
mydea marked this conversation as resolved.
},
afterAllSetup(client) {
// Auto-detect if we should force the integration when running with 'ai' package available
Expand Down
1 change: 1 addition & 0 deletions packages/server-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ export type {
RedisTracingChannelFactory,
RedisTracingChannelSubscribers,
} from './redis/redis-dc-subscriber';
export { subscribeVercelAiTracingChannel } from './vercel-ai/vercel-ai-dc-subscriber';
Loading
Loading