OpenTelemetry

Vercel AI SDK

The AI SDK emits OpenTelemetry spans for each call when telemetry is enabled. Register an OpenTelemetry exporter in your app, point it at your collector, and import the traces.

  1. Register the OpenTelemetry SDK in your app with an OTLP exporter pointed at your collector.
  2. Turn on telemetry per call and give each call the blueprint's step name.
  3. Follow the OpenTelemetry panel to import.

Name each call after its step

const { text } = await generateText({
  model,
  prompt,
  experimental_telemetry: { isEnabled: true, functionId: "draft_reply" },
});

Where the log lands

In your collector's trace file.

How it reaches the harness

Copy the file to where you run the harness.

Read the full guide on GitHub

Frameworks that speak OpenTelemetry

20 platform guides in total.