---
title: relayThrough
description: "Where the relay sends the page's spans when your app has its own OpenTelemetry provider: straight to the OTLP target, or through the provider."
sidebar:
  label: "relayThrough"
related:
  - /observability/relay
  - /observability/where-spans-go
  - /observability/define-observability
---

`relayThrough` matters only when the server's spans go through a provider your app owns: one you pass as
`tracerProvider`, or one the app registered (Sentry, `@vercel/otel`, `dd-trace`). It decides how the page's relayed
spans reach the backend then. With a provider this package builds, the page's spans always go through it and this
option does nothing.

## Example

```ts title="lib/observability.ts"
import { defineObservability } from "@webmcp-agents/telemetry/server";

// The app registered its own provider (Sentry, @vercel/otel): the
// server's spans go through it. "provider" sends the page's spans
// through it too, with new span ids, so its processors see them.
export const observability = defineObservability({
  relayThrough: "provider",
});
```

## Options

| Prop | Type | Default | Description |
| - | - | - | - |
| `relayThrough?` | `"exporter" \| "provider"` | `"exporter"` | Where the relay sends the browser's spans when the server's go through an app's provider: straight to the OTLP target, or re-created through the provider. |

Every other option is on [defineObservability](/docs/observability/define-observability#options).

## The two paths

**"exporter" (default)**

Straight to the OTLP target (`exporters`, else the `OTEL_EXPORTER_OTLP_*` variables), with the browser's own span
ids. A run and its tool calls need no reordering, and line up with the server's step spans.

**"provider"**

Re-created through the app's provider, which gives them new span ids. For an app whose provider must see every
span: its own processors and its own exporter.

## Your backend

<RememberBackend />

**Any other backend**

Your backend's spans go through a provider this package builds, so `relayThrough` does nothing.

**Datadog**

With the agentless intake, nothing to choose. With `dd-trace`'s provider, the default sends the page's spans straight
to an OTLP target when one is set; with none, they go through `dd-trace`'s provider.

**Sentry**

Sentry's provider carries the server's spans. With no OTLP target set, the page's spans are re-created through it;
set `relayThrough: "provider"` to keep that even when an `OTEL_EXPORTER_OTLP_*` target is set.

**Vercel**

The provider `registerOTel` registers carries the server's spans. `@vercel/otel` reads the same
`OTEL_EXPORTER_OTLP_*` variables, so a target usually resolves and the page's spans go straight to it, keeping
their ids.

## Notes

**With no OTLP target, it is the provider**

When neither `exporters` nor the `OTEL_EXPORTER_OTLP_*` variables give a target, there is nothing to send straight
to: relayed spans go through the app's provider whatever this option says.

**Parents first, and a 30 second hold**

Through the provider, each span is re-created with its recorded times, parents first, in the browser's trace. The
page sends a run's spans together, so parents usually come first; a child that still arrives a batch before its
parent waits for it up to 30 seconds.

## Next

**[appIntegrations](/docs/observability/app-integrations)**

One `chat` span per step when your app registered `@ai-sdk/otel` too.

**[Span names and types](/docs/observability/spans)**

Every span and attribute name as a constant, and the OpenTelemetry types the options take.
