---
title: Configuring Tracing
product: vercel
url: /docs/tracing/configure-tracing
canonical_url: "https://vercel.com/docs/tracing/configure-tracing"
last_updated: 2026-11-03
type: how-to
prerequisites:
  - /docs/tracing
related:
  - /docs/tracing/session-tracing
  - /docs/tracing/instrumentation
  - /docs/rbac/access-roles/team-level-roles
  - /docs/tracing
  - /docs/cli/traces
summary: Turn tracing on or off and control sampling for production and preview traffic, including default tracing for Next.js projects.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Configuring Tracing

With tracing turned on, Vercel continuously collects traces from your production and preview traffic, so you can debug real requests without reproducing them first. You control how much Vercel collects with sampling rules you set per project. Vercel also turns tracing on by default for eligible Next.js projects created on or after November 5, 2026.

> Tracing is available on Enterprise, Pro, and Hobby plans

## When to use tracing

Tracing captures traces from real traffic in the background, unlike [Session Tracing](/docs/tracing/session-tracing), which only captures requests from your own browser session. Because Vercel has already collected the traces, you don't have to reproduce a problem to investigate it.

Use tracing to:

- Debug production issues after they happen, using traces that Vercel already collected.
- Catch rare or intermittent errors that you can't reliably reproduce.
- Monitor performance across real user traffic, not only your own session.
- Control how many traces you collect with sampling rules that target specific environments and paths.

## What tracing captures

A trace can include four kinds of spans:

- **Infrastructure spans**: How the request moved through Vercel, including routing, middleware, and caching. Every traced request has them.
- **Fetch spans**: Outbound HTTP requests from your functions. If your `package.json` lists `@opentelemetry/api` 1.7 or later, `@vercel/otel` 1.11 or later, or `@opentelemetry/sdk-trace-node` 1.19 or later, Vercel stops recording fetch spans itself, and your OpenTelemetry setup records them instead. With [default tracing](#default-tracing-for-new-next.js-projects), that's the `@vercel/otel` Vercel adds. If nothing in your project registers an OpenTelemetry SDK, such as `@vercel/otel`, your traces have no fetch spans.
- **Framework spans**: Spans your framework emits, such as Next.js routes and rendering. Next.js 13.4 or later emits them once [`@vercel/otel`](/docs/tracing/instrumentation) runs, and default tracing adds `@vercel/otel` for you.
- **Custom spans**: Spans you add with `@opentelemetry/api`. See [Adding custom spans](/docs/tracing/instrumentation#adding-custom-spans).

## Prerequisites

- A Vercel project deployed to production or preview.
- Permission to update the project. Managing sampling rules requires a role with project update access. See [team-level roles](/docs/rbac/access-roles/team-level-roles).

## Turn on tracing

If your project is eligible for [default tracing](#default-tracing-for-new-next.js-projects), you don't need to turn on tracing. Vercel turns it on for you after your first successful build on Next.js 16.5 or later.

For any other project, turn on tracing by adding at least one sampling rule with a rate above 0%. Vercel starts collecting traces as soon as you save it.

You can configure sampling rules from two places in the dashboard:

- **Project settings**: Select your team and project, then go to [**Settings → Tracing**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fsettings%2Ftracing\&title=Go+to+Tracing+settings).
- **Logs page**: Select your team and project, then open [**Logs**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Flogs\&title=Go+to+Logs) in the sidebar. In the search bar, select the settings icon next to the tracing filter icon.

To add a rule:

1. Open the tracing configuration from either entry point above.
2. Select **Add Sampling Rule**.
3. Choose the **Environment** to sample: **All Environments**, **Production**, or **Preview**.
4. Set the **Rate**, the percentage of matching requests to trace, from 0 to 100%. A rate of 0% matches requests but collects nothing.
5. (Optional) Enter a **Request Path Prefix** to apply the rule only to matching paths, such as `/api`. Leave it blank to match every path.
6. Select **Save**.

## Default tracing for new Next.js projects

Vercel turns on tracing for new Next.js projects, so you get traces, including Next.js framework spans, without any setup.

Your project is eligible for default tracing when all of these are true:

- You created the project on or after November 5, 2026.
- The deployment builds on Vercel with Next.js 16.5 or later. Deployments made with `vercel deploy --prebuilt` don't qualify.
- The deployment includes at least one Node.js function. Static exports and apps that only use the Edge runtime don't qualify.
- You haven't turned off tracing for the project.

After the first successful build on Next.js 16.5 or later, Vercel:

1. Turns on tracing with one sampling rule that traces 100% of requests in all environments. You can change this rule like any other. See [Manage sampling rules](#manage-sampling-rules).
2. Adds `@vercel/otel` to each build so your traces include Next.js framework spans. Vercel doesn't change your `package.json` or lockfile. Spans use your project name as the service name. To use a different name, set the `OTEL_SERVICE_NAME` environment variable.

You don't get framework spans automatically in these cases:

- Your project already has an `instrumentation` file, such as `instrumentation.ts`, in the project folder, its `src` folder, or a parent folder in your monorepo. To get framework spans, register `@vercel/otel` in that file, as shown in [Getting started](/docs/tracing/instrumentation#getting-started).
- Your project uses `@opentelemetry/api` 1.10 or later, directly or through another package. To get framework spans, [install a 1.9.x version](/docs/tracing/instrumentation#using-default-tracing), or [set up `@vercel/otel`](/docs/tracing/instrumentation#getting-started) yourself.
- Your Next.js config sets `instrumentationInject`, directly or through a plugin that wraps your config. To get framework spans, [set up `@vercel/otel`](/docs/tracing/instrumentation#getting-started) yourself.

In all of these cases, tracing stays on and still collects infrastructure spans.

Vercel bills default tracing like any other tracing usage. The default rule traces 100% of requests, and every indexed span uses at least one span unit. For example, if each request produces 20 indexed spans, tracing 100,000 requests uses at least 2 million span units. To use fewer span units, [lower the rule's **Rate**](#manage-sampling-rules) or [turn off tracing](#turn-off-tracing). For rates, see [Usage and pricing](#usage-and-pricing).

## Manage sampling rules

Manage sampling rules in [**Settings → Tracing**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fsettings%2Ftracing\&title=Go+to+Tracing+settings), or from the Logs page as described in [Turn on tracing](#turn-on-tracing). You can add up to 10 rules per project. Vercel applies the first rule that matches a request, and new rules go to the bottom of the list. To learn how Vercel picks between overlapping rules, see [Sampling](/docs/tracing#sampling).

To collect fewer traces, lower a rule's **Rate** or narrow it with a **Request Path Prefix**.

To stop tracing one path, such as `/health`, put a 0% rule for that path above any broader rule. You can't reorder rules, so if a broader rule already exists, such as the 100% rule from default tracing, make these changes before you save:

1. Remove the broader rule.
2. Add the 0% rule for the path.
3. Add the broader rule back.
4. Select **Save**.

You can also manage rules from the terminal with [`vercel traces config`](/docs/cli/traces#manage-trace-sampling-rules). The CLI accepts rates from 1 to 100%, so add 0% rules from the dashboard.

## Turn off tracing

To turn off tracing for a project:

1. Select your team and project, then go to [**Settings → Tracing**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Fsettings%2Ftracing\&title=Go+to+Tracing+settings).
2. Remove all sampling rules.
3. Select **Save**.

Vercel stops collecting production and preview traces for the project as soon as you save, and you stop incurring tracing charges for it.

If the project has [default tracing](#default-tracing-for-new-next.js-projects), Vercel also stops adding `@vercel/otel` from your next deployment and doesn't turn default tracing back on. To turn tracing on again, add a sampling rule. Vercel then resumes adding `@vercel/otel` from your next deployment.

## View your traces

Once tracing is collecting data, view your traces in the dashboard:

1. Select your team and project, then open [**Traces**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Ftraces\&title=Go+to+Traces) in the sidebar.
2. Search or filter to find the request you want.
3. Select a row to open its spans.

The trace timeline shows the spans and their durations:

![Trace timeline showing spans for a request.](https://7nyt0uhk7sse4zvn.public.blob.vercel-storage.com/front/docs/observability/tracing-span-example-light.png?lightbox)

To open the trace for a single request, start from its log in [**Logs**](https://vercel.com/d?to=%2F%5Bteam%5D%2F%5Bproject%5D%2Flogs\&title=Go+to+Logs). For the full walkthrough, including the available filters and the timeline, tree, and waterfall layouts, see [Viewing traces in the dashboard](/docs/tracing#viewing-traces-in-the-dashboard).

You can also inspect a single trace from the terminal with [`vercel traces inspect <request-id>`](/docs/cli/traces), using the request ID from a log line.

## Usage and pricing

Vercel measures tracing usage in span units, counting the spans it indexes after sampling.

Plan

Pricing

Hobby

1

million span units included per month

Pro

$0.50

per 1 million span units

Enterprise

Starting at

$0.50

per 1 million span units

An indexed span up to 2 KiB (2,048 bytes) counts as one span unit. Larger spans count in additional 2 KiB increments. For example, a 3 KiB span counts as two span units, and a 5 KiB span counts as three.

On the Hobby plan, when your team uses all of its included span units for the usage period, Vercel pauses tracing for every project on the team. Tracing doesn't resume on its own. After the period ends, anyone with permission to update every project on the team can select **Resume Tracing** in **Settings → Tracing**. To resume right away, upgrade to Pro.

To see how many span units your team has used, open [**Usage**](https://vercel.com/d?to=%2F%5Bteam%5D%2F~%2Fusage%2Ftracing-span-units\&title=Go+to+Usage) in your team's dashboard. For more on tracking spend, see [Manage and optimize usage](/docs/pricing/manage-and-optimize-usage).

To stop tracing charges for a project, remove all of its sampling rules. See [Turn off tracing](#turn-off-tracing).

## Retention

Vercel keeps collected traces for these periods:

| Plan       | Retention |
| ---------- | --------- |
| Hobby      | 3 days    |
| Pro        | 14 days   |
| Enterprise | 14 days   |

## Limitations

- Each traced request is limited to **10 MB of compressed trace data**.
- Vercel drops spans that still exceed **1 MB of compressed data** after [attribute truncation](/docs/tracing#attribute-truncation).
- Custom spans from functions using the [Edge runtime](/docs/functions/runtimes/edge) don't appear in traces.

For details, see the shared [tracing limitations](/docs/tracing#limitations).

## More resources

- [Tracing overview](/docs/tracing)
- [Session Tracing](/docs/tracing/session-tracing)
- [Instrumentation](/docs/tracing/instrumentation)
- [Trace Drains](/docs/drains/reference/traces)


---

[View full sitemap](/docs/sitemap)


If you encounter incorrect information, can’t find what you need, need a capability Vercel doesn’t currently offer, or have any other feedback to report, please do it by following the instructions at https://vercel.com/feedback.md.
