- Configure an OpenTelemetry (OTEL) trace exporter (instructions differ for Next.js and Node.js).
- Instrument your Vercel AI SDK calls and attach Raindrop metadata (common to both).
Setting up OpenTelemetry in Next.js
First, install the required OpenTelemetry packages.instrumentation.ts file.
Setting up OpenTelemetry in Node.js
For Node.js applications, first install the required OpenTelemetry packages.Using with Sentry (Next.js)
If you’re already using Sentry for error tracking and tracing in your Next.js app, you can add Raindrop’s trace exporter directly to Sentry’s OpenTelemetry configuration instead of setting up a separate instrumentation file. First, install the required OpenTelemetry packages alongside your existing Sentry setup:openTelemetrySpanProcessors option in your sentry.server.config.ts:
Error: @opentelemetry/api: Attempted duplicate registration of API: trace.
Instrumenting AI SDK Calls
To instrument your AI SDK calls:- Enable
experimental_telemetry: { isEnabled: true }at all AI SDK call sites - Add Raindrop metadata at the top-level call that handles user input and produces the final output using
raindrop.metadata()
Troubleshooting
Enable OpenTelemetry Debug Logging
If traces aren’t appearing in the Raindrop dashboard, enable debug logging to see what’s happening under the hood:Ensure Telemetry is Enabled at All Call Sites
A common issue is forgetting to addexperimental_telemetry: { isEnabled: true } to nested AI SDK calls. Every generateText, streamText, generateObject, etc. call must have telemetry enabled for traces to be captured: