SigNoz Cloud - This page is relevant for SigNoz Cloud editions.
Self-Host - This page is relevant for self-hosted SigNoz editions.

Nextjs OpenTelemetry Instrumentation

This document contains instructions on how to set up OpenTelemetry instrumentation in your Nextjs applications and view your application traces in SigNoz.

If you also need browser-side coverage for your Nextjs app, follow the client-side instrumentation guide alongside this backend setup.

Info

Using self-hosted SigNoz? Most steps are identical. To adapt this guide, update the endpoint and remove the ingestion key header as shown in Cloud → Self-Hosted.

Send traces to SigNoz

Based on your application environment, you can choose the setup below to send traces to SigNoz.

From VMs, there are two ways to send data to SigNoz:

  • Direct to SigNoz Cloud (recommended for beginners): no extra installs beyond the SDK; you only need the region endpoint and ingestion key.
  • Optional: Install a local OTel Collector binary on the VM: it listens at http://localhost:4318, forwards telemetry to SigNoz, and does not require an ingestion key from the app. Install it with the OTel Collector binary guide.

Step 1. Install OpenTelemetry packages

npm install --save @vercel/otel @opentelemetry/api

Step 2. Update next.config.mjs to include instrumentationHook

📝 Note
This step is only needed when using Next.js 14 and below.
/** @type {import('next').NextConfig} */
const nextConfig = {
  // include instrumentationHook experimental feature
  experimental: {
    instrumentationHook: true,
  },
}

export default nextConfig

Step 3. Create instrumentation.ts or instrumentation.js

instrumentation.ts
import { registerOTel, OTLPHttpJsonTraceExporter } from '@vercel/otel';
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';

diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR); // set to DEBUG when troubleshooting

export function register() {
  registerOTel({
    serviceName: '<service_name>',
    traceExporter: new OTLPHttpJsonTraceExporter({
      url: 'https://ingest.<region>.signoz.cloud:443/v1/traces',
      headers: { 'signoz-ingestion-key': '<your-ingestion-key>' },
    }),
  });
}
  • <service_name> is the name you want to appear in SigNoz.
  • Set <region> to match your SigNoz Cloud region.
  • Replace <your-ingestion-key> with your SigNoz ingestion key.

If you installed the local OTel Collector binary on the VM, change the exporter URL to http://localhost:4318/v1/traces and omit the headers block (ingestion key not required).

📝 Note

The instrumentation file should live in the project root (or inside src/ if you keep Next.js code there). Do not place it inside the app or pages directory. A working example is available in the

sample Next.js repo

.

Step 4. Run the application

npm run dev
# or
next dev

Interact with the app and validate if traces arrive in SigNoz using the section below.

Validating instrumentation by checking for traces

With the app running, confirm that traces reach SigNoz.

  1. Trigger a request in your app a few times to generate traffic and wait for buffered data to flush.
  2. In SigNoz, open Services, refresh, and confirm your app appears.
  3. Open Traces, apply filters, and inspect your spans.

If you face any issues while trying out SigNoz, you can reach out with your questions in #support channel 👇

SigNoz Slack community

Next Steps

Last updated: November 20, 2025

Edit on GitHub

Was this page helpful?