OpenInference Vercel
Note: This package requires you to be using the Vercel AI SDK version 3.3 or higher.
Installation
Usage
@arizeai/openinference-vercel provides a set of utilities to help you ingest Vercel AI SDK spans into OpenTelemetry compatible platforms and works in conjunction with Vercel’s AI SDK OpenTelemetry support. @arizeai/openinference-vercel works with typical node projects, as well as Next.js projects. This page will describe usage within a node project, for detailed usage instructions in Next.js follow Vercel’s guide on instrumenting Next.js.
To process your Vercel AI SDK Spans, setup a typical OpenTelemetry instrumentation boilerplate file, add a OpenInferenceSimpleSpanProcessor or OpenInferenceBatchSpanProcessor to your OpenTelemetry configuration.
Note: The OpenInferenceSpanProcessor alone does not handle the exporting of spans so you will need to pass it an exporter as a parameter.
Here are two example instrumentation configurations:
- Manual instrumentation config for a Node v23+ application.
-
Next.js register function utilizing
@vercel/otel.
- Manual Instrumentation
- @vercel/otel
When instrumenting a Next.js application, traced spans will not be “root spans” when the OpenInference span filter is configured. This is because Next.js parents spans underneath http requests, which do not meet the requirements to be an OpenInference span.
experimental_telemetry parameter to true.
Spans may not be exported if still queued in the processor when your process exits. Use
OpenInferenceSimpleSpanProcessor for immediate export, or call provider.shutdown() to explicitly flush spans before exit when using OpenInferenceBatchSpanProcessor.For simpler setup, consider using @arizeai/phoenix-otel which handles this automatically.
