Next.js provides an instrumentation.ts (or .js) file to integrate monitoring tools like OpenTelemetry.
This file exports a register function that is called once when a new Next.js server instance starts.
tsexport async function register() { if (process.env.NEXT_RUNTIME === 'nodejs') { await import('./instrumentation-node') } }