Trace Drains require a Vercel Pro or Enterprise plan. On Hobby, use the exporter env-var fallback below - same endpoint, configured in your project instead of a drain.
Step 1 - Get your Glassray ingest details
In Glassray: Settings → Sources → Add source → Vercel. Glassray creates the source, mints a write-scoped ingest key (shown once), and displays the two values you’ll paste into Vercel:- the endpoint URL (
https://app.glassray.ai/api/public/otel/v1/traces) - one custom header line (
Authorization: Bearer glsk_…)
Step 2 - Add a Trace Drain in Vercel
In the Vercel dashboard: Team Settings → Drains → Add Drain.- Choose data to drain: Traces
- Configure the drain: name it, pick the Vercel project(s) to send
- Configure the destination - stay on the Custom Endpoint tab:
- URL → paste the Glassray endpoint
- Encoding → JSON (not Protobuf - Glassray’s endpoint is JSON-only and will reject protobuf with a
415) - Custom Headers → toggle on, paste the
Authorization: Bearer glsk_…line - Signature Verification Secret → leave as generated (not used by Glassray; auth rides the header)
- Click Test - expect success - then Create Drain
Step 3 - Emit AI telemetry and verify
Register OpenTelemetry in your app’sinstrumentation.ts:
instrumentation.ts
What Glassray captures
A drained trace mixes Vercel’s own spans (edge routing, function invocation, Next.js framework steps) with your app’s AI spans. Glassray:- reads the
gen_ai.*semantic conventions and the AI SDK’sai.*telemetry attributes - model, tokens (including cache read/write), messages, tool calls, finish reason; - computes cost from tokens × model price when the span doesn’t carry an explicit cost;
- merges a trace that arrives across several drain POSTs (normal for Vercel) into one complete trace;
- names the trace from your app’s request handler (e.g.
POST /api/chat/route), not Vercel’s infra spans; - tags each trace with its Vercel project, deployment, repo, and commit SHA from the drain’s resource attributes.
Hobby plan fallback
Without a drain, point the AI SDK / OTel exporter at the same endpoint via project env vars (Project → Settings → Environment Variables):Troubleshooting
- Test button fails - check the URL has no trailing spaces, Encoding is JSON, and the header line is exactly
Authorization: Bearer glsk_…(one line, no quotes). - Drain created but no traces - confirm the drain includes your Vercel project, telemetry is registered (
instrumentation.ts), and the AI route runs on the Node runtime. - Traces arrive but no AI spans - enable
experimental_telemetryon your AI SDK calls (or add@ai-sdk/otel); plain HTTP spans alone mean the AI instrumentation isn’t emitting. - Using Sentry v8+? Its SDK takes over OTel setup by default and can swallow spans - set
skipOpenTelemetrySetup: trueinSentry.initand keep@vercel/otelas the registration point. - Very large prompts - Vercel truncates span attributes over ~1 MB (the trace shows a
truncatedtag in Glassray) and drops spans over the cap entirely.