---
title: The telemetry APIs
description: "What you have after installation, one page per API: the server's layer and its options, the relay, the page's observer and the run events."
sidebar:
  label: "The telemetry APIs"
related:
  - /observability/installation
  - /reference/telemetry
---

Installation wires three pieces: the layer on the server, the relay route, and the observer on the page. Each has a
page of its own below, in the order you would reach for them, and each opens on the backend you picked during
installation wherever a backend changes something. Most apps never need more than the defaults; read on when you want
to change where spans go, what they record, or how many turns are kept.

**[defineObservability](/docs/observability/define-observability)**

The server's layer: the chat handler records model steps with it.

**[Where spans go](/docs/observability/where-spans-go)**

The five rules that pick a destination, and the `OTEL_*` environment.

**[otlp](/docs/observability/otlp)**

One OTLP destination in code: a URL, a protocol, headers.

**[The relay](/docs/observability/relay)**

`/api/telemetry`: the page's spans in, checked and redacted.

**[relayThrough](/docs/observability/relay-through)**

The page's spans when your app has its own provider.

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

One `chat` span per step beside your own `@ai-sdk/otel`.

**[observeAgents](/docs/observability/observe-agents)**

The page's runs and tool calls as spans.

**[onAgentRun](/docs/observability/on-agent-run)**

The run events for your own analytics, no backend.

**[Custom events](/docs/observability/custom-events)**

Your own events and spans in the run's trace, page and server.

**[Sampling](/docs/observability/sampling)**

Keep a share of turns, or decide per turn.

**[metadataMapping](/docs/observability/metadata-mapping)**

Group a conversation in your backend.

**[Privacy and redaction](/docs/observability/privacy)**

What a span records, and how to record more.

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

Every span and attribute name as a constant, and the option types.

**[Collector and troubleshooting](/docs/observability/collector)**

Several backends at once, and spans that do not arrive.

## Where each one lives

- `@webmcp-agents/telemetry/server`: `defineObservability`, `otlp`, and the layer's `relay`, `event` and `span`.
  Server only.
- `@webmcp-agents/telemetry`: `observeAgents`, `consoleExporter`, `recordAgentEvent` and `withAgentSpan`, for the
  page.
- `@webmcp-agents/telemetry/react`: `<ObserveAgents>`, the same observer as a component.
- `@webmcp-agents/chat`: `onAgentRun`, the run events both sides are built on.
