@vight/nextjs

Next.js

Instrument Next.js App Router applications with @vight/nextjs and the instrumentation hook.

Next.jsApp Router@vercel/otel

Integration model

The Next.js adapter uses the App Router instrumentation hook so telemetry starts through Next's supported startup path. This keeps request tracing aligned with the framework lifecycle and avoids adding a second trace provider inside the app.

Use the default re-export when environment variables provide all configuration. Use the custom registration function when the service name, environment, or log capture behavior needs to be controlled from code.

Install

Terminal
npm install @vight/nextjs @vercel/otel

Create instrumentation.ts

src/instrumentation.ts
export { register } from "@vight/nextjs/instrumentation";

Custom configuration

src/instrumentation.ts
import { registerVightNext } from "@vight/nextjs/instrumentation";

export async function register() {
  await registerVightNext({
    serviceName: "web",
    environment: process.env.VERCEL_ENV ?? "production",
    captureConsoleLogs: true,
  });
}

The adapter uses @vercel/otel for Next.js request tracing. It starts Vight log capture only in the Node.js runtime and keeps trace provider ownership with the framework integration.

Runtime note

Next.js applications can run code in more than one runtime. Validate telemetry from a real route after deployment, then confirm the service name, environment, trace, and log context match the project filters you use in Vight.