@vight/nextjs
Next.js
Instrument Next.js App Router applications with @vight/nextjs and the instrumentation hook.
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
npm install @vight/nextjs @vercel/otelCreate instrumentation.ts
export { register } from "@vight/nextjs/instrumentation";Custom configuration
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.