Using @vercel/otel
To get started, you must install @vercel/otel:
Terminal npm install @vercel/otel
Next, create a custom instrumentation.ts (or .js) file in the root directory of the project (or inside src folder if using one):
your-project/instrumentation.ts import { registerOTel } from '@vercel/otel'
 
export function register() {
  registerOTel('next-app')
}
Good to know
The instrumentation file should be in the root of your project and not inside the app or pages directory. If you're using the src folder, then place the file inside src alongside pages and app.
If you use the pageExtensions config option to add a suffix, you will also need to update the instrumentation filename to match.
We have created a basic with-opentelemetry example that you can use.
Manual OpenTelemetry configuration