Vercel

One-click observability for Vercel — auto-configured env vars, Log Drain for Function and Edge logs, full SDK support for Next.js.

Vercel

The Vercel integration gives you observability with zero configuration. Install from the marketplace and every project gets instrumented automatically.

What you get

SignalSourceCode changes?
Function logsLog Drain (automatic)No
Edge logsLog Drain (automatic)No
Build logsLog Drain (automatic)No
HTTP tracesSDK1 line
Custom spansSDK1 line
Runtime metricsSDK1 line
Web VitalsBrowser SDK1 line

Step 1: Install the integration

Go to the Obtrace integration on Vercel Marketplace and click Add Integration.

The integration will:

  1. Authenticate via OAuth
  2. Provision an Obtrace project for your team
  3. Inject environment variables into all your Vercel projects:
    • OBTRACE_API_KEY
    • OBTRACE_PLATFORM=vercel
    • OBTRACE_AUTO_INSTRUMENT=true
  4. Configure a Log Drain that streams all Function, Edge, Static, and Build logs to Obtrace

After installation, redeploy any project and its logs will start flowing immediately.

Step 2: Add the SDK (optional, for traces + metrics)

Install the SDK:

npm install @obtrace/sdk-js

Next.js (App Router)

// app/layout.tsx
import { initNodeSDK } from "@obtrace/sdk-js/node";
 
const sdk = initNodeSDK({
  apiKey: process.env.OBTRACE_API_KEY!,
  serviceName: "my-nextjs-app",
});

Next.js (Route Handler)

// app/api/checkout/route.ts
import { NextResponse } from "next/server";
 
export async function POST(req: Request) {
  // The SDK auto-instruments if NODE_OPTIONS is set
  // Otherwise, use the wrapper:
  return NextResponse.json({ ok: true });
}

Edge Functions

// middleware.ts
import { initNodeSDK } from "@obtrace/sdk-js/node";
 
const sdk = initNodeSDK({
  apiKey: process.env.OBTRACE_API_KEY!,
  serviceName: "my-app-edge",
});

Step 3: Add the Browser SDK (optional, for Web Vitals)

npm install @obtrace/sdk-browser
// app/providers.tsx
"use client";
import { initBrowserSDK } from "@obtrace/sdk-browser/browser";
 
const sdk = initBrowserSDK({
  apiKey: process.env.NEXT_PUBLIC_OBTRACE_API_KEY!,
  serviceName: "my-app-browser",
});

What the Log Drain captures

The Vercel Log Drain streams these fields for every log entry:

FieldDescription
sourcelambda, edge, static, build, external
messageLog message content
levelinfo, warn, error
timestampUnix timestamp
projectIdVercel project ID
deploymentIdDeployment that generated the log
requestIdRequest ID for correlation
hostRequest hostname
pathRequest path
statusCodeHTTP status code
methodHTTP method
environmentproduction, preview, development

All fields are preserved as attributes on the OTLP log record in Obtrace.

Environment variables injected

VariableValuePurpose
OBTRACE_API_KEYobt_live_...Authentication
OBTRACE_PLATFORMvercelPlatform detection
OBTRACE_AUTO_INSTRUMENTtrueEnable auto-instrumentation

Nesta página