{"slug": "vercel-ai-sdk-observability-monitoring-with-opentelemetry", "title": "Vercel AI SDK Observability & Monitoring with OpenTelemetry", "summary": "SigNoz has released a guide for setting up OpenTelemetry-based observability and monitoring for the Vercel AI SDK, enabling developers to trace AI function calls, request durations, and custom metadata in Next.js applications. The integration streams telemetry data to SigNoz, allowing teams to debug latency, set performance alerts, and improve reliability of production AI features. The guide includes step-by-step instructions for instrumenting Next.js apps, configuring OpenTelemetry exporters, and enabling Vercel AI SDK telemetry.", "body_md": "What is Vercel AI SDK Observability?\n\nVercel AI SDK observability gives you visibility into AI function calls, request durations, inputs, outputs, and custom metadata across your Next.js application. This guide covers setting up OpenTelemetry instrumentation to capture traces and spans from the Vercel AI SDK and stream that data to SigNoz.\n\nWith full Vercel AI SDK observability in SigNoz, you can trace AI interactions end-to-end, debug latency, set alerts on degraded performance, and improve the reliability of your AI features. This is especially valuable for production-grade Vercel observability where visibility into model behavior and user interactions is critical.\n\nExplore the [SigNoz Vercel AI SDK example chatbot](https://github.com/SigNoz/vercel-ai-sdk-opentelemetry-example), which includes observability and monitoring via OpenTelemetry.\n\nPrerequisites\n\n- Next.js app\n- Vercel AI SDK integrated into the app\n- SigNoz setup (choose one):\n[SigNoz Cloud account](https://signoz.io/teams/)with an active ingestion key- Self-hosted SigNoz instance\n\n- Network access from your app to the chosen SigNoz endpoint\n\nInstrument your Next.js App with OpenTelemetry\n\nFor detailed OpenTelemetry instrumentation instructions for Next.js, see the [Next.js OpenTelemetry instrumentation guide](https://signoz.io/docs/instrumentation/opentelemetry-nextjs/).\n\nConfigure Vercel AI SDK Observability with OpenTelemetry\n\n**Step 1.** Install OpenTelemetry packages\n\n```\nnpm install @vercel/otel @opentelemetry/api\n```\n\n**Step 2.** Update ** next.config.mjs** to include instrumentationHook\n\nThis step is only needed when using NextJs 14 and below\n\n``` js\n/** @type {import('next').NextConfig} */\nconst nextConfig = {\n  // include instrumentationHook experimental feature\n  experimental: {\n    instrumentationHook: true,\n  },\n}\nexport default nextConfig\n```\n\n**Step 3.** Create ** instrumentation.ts** file(in root project directory)\n\n``` js\nimport { registerOTel, OTLPHttpJsonTraceExporter } from '@vercel/otel'\n// Add otel logging\nimport { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api'\ndiag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR) // set diaglog level to DEBUG when debugging\nexport function register() {\n  registerOTel({\n    serviceName: '<service_name>',\n    traceExporter: new OTLPHttpJsonTraceExporter({\n      url: 'https://ingest.<region>.signoz.cloud:443/v1/traces',\n      headers: { 'signoz-ingestion-key': '<your-ingestion-key>' },\n    }),\n  })\n}\n```\n\nis the name of your service`<service_name>`\n\n: Your SigNoz Cloud`<region>`\n\n**region**: Your SigNoz`<your-ingestion-key>`\n\n**ingestion key**\n\nThe instrumentation file should be in the root of your project and not inside the app or pages directory. If you're using the src folder, then place the file inside src alongside pages and app.\n\nUsing self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in [Cloud → Self-Hosted](https://signoz.io/docs/ingestion/cloud-vs-self-hosted/#cloud-to-self-hosted).\n\nYour Next.js app is now properly instrumented.\n\n**Step 4.** Verify Instrumentation Locally\n\nRun your Next.js application in development mode:\n\n```\nnpm run dev\n```\n\nOpenTelemetry output appears in the terminal when the application starts, confirming that the instrumentation.ts file was loaded correctly.\n\nTo see detailed trace export logs, you can temporarily set the DiagLogLevel to DEBUG in instrumentation.ts:\n\n```\ndiag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG)\n```\n\nEnable Vercel AI SDK Telemetry\n\nThe Vercel AI SDK uses [OpenTelemetry](https://signoz.io/opentelemetry/) to collect telemetry data. OpenTelemetry is an open-source observability framework designed to provide standardized instrumentation for collecting telemetry data.\n\nEnabling Telemetry\n\nFor more detail on available telemetry options, see the [Vercel AI SDK telemetry documentation](https://ai-sdk.dev/docs/ai-sdk-core/telemetry#telemetry).\n\nYou can then use the `experimental_telemetry`\n\noption to enable telemetry on specific function calls while the feature is experimental:\n\n``` js\nconst result = await generateText({\n  model: openai('gpt-4-turbo'),\n  prompt: 'Write a short story about a cat.',\n  experimental_telemetry: { isEnabled: true },\n})\n```\n\nWhen telemetry is enabled, you can also control whether you want to record the input values and the output values for the function. By default, both are enabled. You can disable them by setting the `recordInputs`\n\nand `recordOutputs`\n\noptions to `false`\n\n.\n\n```\nexperimental_telemetry: { isEnabled: true, recordInputs: false, recordOutputs: false}\n```\n\nDisabling the recording of inputs and outputs can be useful for privacy, data transfer, and performance reasons. You might, for example, want to disable recording inputs if they contain sensitive information.\n\nTelemetry Metadata\n\nYou can provide a `functionId`\n\nto identify the function that the telemetry data is for, and `metadata`\n\nto include additional information in the telemetry data.\n\n``` js\nconst result = await generateText({\n  model: openai('gpt-4-turbo'),\n  prompt: 'Write a short story about a cat.',\n  experimental_telemetry: {\n    isEnabled: true,\n    functionId: 'my-awesome-function',\n    metadata: {\n      something: 'custom',\n      someOtherThing: 'other-value',\n    },\n  },\n})\n```\n\nCustom Tracer\n\nYou can provide a `tracer`\n\nwhich must return an OpenTelemetry `Tracer`\n\n. This is useful in situations where you want your traces to use a `TracerProvider`\n\nother than the one provided by the `@opentelemetry/api`\n\nsingleton.\n\n``` js\nconst tracerProvider = new NodeTracerProvider()\nconst result = await generateText({\n  model: openai('gpt-4-turbo'),\n  prompt: 'Write a short story about a cat.',\n  experimental_telemetry: {\n    isEnabled: true,\n    tracer: tracerProvider.getTracer('ai'),\n  },\n})\n```\n\nOnce configured, your Vercel AI SDK commands automatically emit traces, spans, and events. See the [Vercel AI SDK collected data reference](https://ai-sdk.dev/docs/ai-sdk-core/telemetry#collected-data) for details on the types of spans and events generated.\n\nVercel AI SDK traces are available in SigNoz under the Traces tab:\n\nIf you click on any span, you can see the detailed trace of which it is a part of.\n\nVercel AI SDK Observability Dashboard\n\nThe [Vercel AI SDK Observability Dashboard](https://signoz.io/docs/dashboards/dashboard-templates/vercel-ai-sdk-dashboard/) provides specialized visualizations for monitoring your AI applications. The dashboard includes pre-built charts and metrics specifically tailored for Vercel AI SDK telemetry data, along with import instructions to get started quickly.", "url": "https://wpnews.pro/news/vercel-ai-sdk-observability-monitoring-with-opentelemetry", "canonical_source": "https://signoz.io/docs/vercel-ai-sdk-observability", "published_at": "2026-05-28 00:00:00+00:00", "updated_at": "2026-05-29 16:25:47.006365+00:00", "lang": "en", "topics": ["ai-tools", "ai-infrastructure", "ai-products", "mlops"], "entities": ["Vercel AI SDK", "OpenTelemetry", "SigNoz", "Next.js"], "alternates": {"html": "https://wpnews.pro/news/vercel-ai-sdk-observability-monitoring-with-opentelemetry", "markdown": "https://wpnews.pro/news/vercel-ai-sdk-observability-monitoring-with-opentelemetry.md", "text": "https://wpnews.pro/news/vercel-ai-sdk-observability-monitoring-with-opentelemetry.txt", "jsonld": "https://wpnews.pro/news/vercel-ai-sdk-observability-monitoring-with-opentelemetry.jsonld"}}