Installation

Install as Agent Plugin Recommended
copilot plugin marketplace add samueltauil/skills-hub
copilot plugin install eas-observe@skills-hub

Works with GitHub Copilot CLI and VS Code (enable chat.plugins.enabled). Plugin eas-observe v1.0.0 follows the Agent Plugins spec.

Install with the gh extension
gh skills-hub install eas-observe

Don't have the extension? Run gh extension install samueltauil/skills-hub first.

Download and extract to your repository:

.github/skills/eas-observe/

Extract the ZIP to .github/skills/ in your repo. The folder name must match eas-observe for Copilot to auto-discover it.

Skill Files (7)

SKILL.md 6.1 KB
---
name: eas-observe
description: Use for anything related to EAS Observe - adding `expo-observe` to an Expo project (ObserveRoot/AppMetricsRoot, markInteractive, useObserve, ObserveInteractiveMarker, the Expo Router / React Navigation integrations for per-route metrics, the expo-image and Reanimated integrations, `Observe.logEvent` events, error reporting via ObserveErrorBoundary and `Observe.reportError`, native crashes, source map and iOS dSYM upload for symbolication, network traces, and config such as sampleRate, errorSampleRate and networkTraces), querying via the EAS CLI (`eas observe:metrics-summary`, `observe:metrics`, `observe:routes`, `observe:events`, `observe:session`, `observe:versions`, `observe:errors`, `observe:traces`, `observe:trace`, `observe:event`) or the Expo MCP `observe_*` tools, interpreting the results (cold/warm launch, TTR, TTI, navigation TTR, update download, and the TTI frameRate/device/network params for slow startups), or shipping an Observe integration inside a third-party package.
license: MIT
---

# EAS Observe

> **EAS service - costs apply.** EAS Observe is an Expo Application Services product. The free EAS plan allows up to 10,000 monthly active users, with a limited set of features; higher usage requires a paid subscription. For details, see https://expo.dev/pricing#plan-features.

EAS Observe tracks startup, navigation, and custom-event performance from production Expo apps, records JavaScript errors and native crashes, and records network requests as trace spans. It needs a development or production build — the native library is not in Expo Go.

> **Source of truth:** https://docs.expo.dev/eas/observe/ — always consult the canonical docs when API details matter, especially get-started, configuration, integrations, and the metrics reference. EAS Observe is evolving; this skill's references are written to stay accurate but may lag the docs.

## Which reference to read

The five reference files in `./references/` cover what people typically need this skill for:

- **Adding EAS Observe to a project** → [`./references/setup.md`](./references/setup.md). Install, wrap the root layout (`AppMetricsRoot` on SDK 55, `ObserveRoot` on SDK 56+), mark the app interactive (global `markInteractive()` on SDK 55, the `useObserve()` hook or `<ObserveInteractiveMarker />` on SDK 56+), optional per-route navigation metrics through the Expo Router / React Navigation integrations, user-defined events via `Observe.logEvent` (SDK 56+), error reporting and native symbolication, network traces (SDK 58+), and runtime configuration (sampling, dispatch, environments, custom endpoint).
- **Querying metrics from the terminal** → [`./references/queries.md`](./references/queries.md). The `npx --yes eas-cli@latest observe:*` commands — `metrics-summary`, `metrics`, `routes`, `events`, `session`, `versions`, `errors`, `traces`, `trace`, `event` — with flags, metric aliases, table layouts, JSON shapes, and common workflows. Also the matching `observe_*` tools in the Expo MCP Server, and how their inputs differ from the CLI flags.
- **Reading a dashboard or CLI output** → [`./references/metrics.md`](./references/metrics.md). Target thresholds per metric, what the automatic TTI params mean (`frameRate.*`, `device.*`, `network.*`), and diagnostic patterns for telling slow-but-smooth startup apart from main-thread contention, hard blocks, or throttled devices.
- **Reporting problems from library integrations** → [`./references/library-integrations.md`](./references/library-integrations.md). The current and future integrations that report problems a library detects as events or errors, with their options, limits, and how to query the reports. Currently: `expo-image` (`expo-image.oversized` events for images decoded far larger than the screen) and `react-native-reanimated` (`reanimated.error` errors and optional `reanimated.warning` events).
- **Shipping an Observe integration in a library** → [`./references/third-party.md`](./references/third-party.md). For package authors only (SDK 57+): optional peer dependency, config declaration merging, `Observe.registerIntegration()`, and event naming.

## Quick links to the docs

- Get started: https://docs.expo.dev/eas/observe/get-started/
- Dashboard guide: https://docs.expo.dev/eas/observe/dashboard/
- Querying with EAS CLI: https://docs.expo.dev/eas/observe/eas-cli/
- Querying with AI agents and the Expo MCP Server: https://docs.expo.dev/eas/observe/ai-agents/
- Metrics reference: https://docs.expo.dev/eas/observe/reference/metrics/
- Expo Router integration: https://docs.expo.dev/eas/observe/integrations/expo-router/
- React Navigation integration: https://docs.expo.dev/eas/observe/integrations/react-navigation/
- Expo Image integration: https://docs.expo.dev/eas/observe/integrations/expo-image/
- Reanimated integration: https://docs.expo.dev/eas/observe/integrations/react-native-reanimated/
- User-defined events: https://docs.expo.dev/eas/observe/events/
- Error reporting: https://docs.expo.dev/eas/observe/errors/
- Configuration: https://docs.expo.dev/eas/observe/configuration/
- Network traces: https://docs.expo.dev/eas/observe/configuration/#network-traces
- Third-party integrations: https://docs.expo.dev/eas/observe/integrations/third-party/
- EAS Update download performance: https://docs.expo.dev/eas/observe/eas-update/
- Troubleshooting: https://docs.expo.dev/eas/observe/reference/troubleshooting/

## Submitting Feedback
If this skill has an error, or misleading or outdated information, tell the user and offer to report it to Expo. A report is optional, and the user decides. Do not send a report before the user agrees.
The `feedback` command of the agent CLI sends a report. Its `--help` lists the categories (`skills` with the subject "eas-observe", `agent-cli` for a problem with the agent CLI, `evals` when an agent repeatedly fails at an Expo task) and the data that a report sends. Show the user the message, and tell the user that the report also carries project and environment details. If you cannot ask the user, put the command with your message in your final summary, so the user can send it. Do not include secrets or personal data.
agents/
openai.yaml 0.5 KB
interface:
  display_name: "EAS Observe"
  short_description: "Set up expo-observe and query launch, route, event, error, and trace data with the EAS CLI"
  default_prompt: "Use $eas-observe to add expo-observe instrumentation (AppMetricsRoot/ObserveRoot, useObserve, ObserveInteractiveMarker, the router integrations, error reporting, network traces), query metrics, errors, and traces with npx --yes eas-cli@latest observe:* commands, and interpret cold/warm launch, TTR, and TTI results."
references/
library-integrations.md 6.8 KB
# Report problems from library integrations

This reference is for **app developers** who want EAS Observe to report problems that a library detects. These built-in integrations do this:

- **Expo Image** (`'expo-image'`): logs an `expo-image.oversized` event when an image is decoded at a much larger size than the screen can display.
- **Reanimated** (`'react-native-reanimated'`): reports Reanimated errors as `reanimated.error` errors, and optionally Reanimated warnings as `reanimated.warning` events.

These integrations do not record metrics. Their reports are user-defined events and errors, so query them with `eas observe:events` and `eas observe:errors` (see [`./queries.md`](./queries.md)). For the per-route navigation metrics from the Expo Router and React Navigation integrations, see [`./setup.md`](./setup.md). To build an integration inside a library, see [`./third-party.md`](./third-party.md).

Both integrations need `expo-observe` set up first (see [`./setup.md`](./setup.md)). Enable them in the same `Observe.configure()` call as any other integration, at module scope, before the app mounts:

```tsx
// app/_layout.tsx
import { Observe } from 'expo-observe';

Observe.configure({
  integrations: {
    'expo-router': true,
    'expo-image': true,
    'react-native-reanimated': true,
  },
});
```

`configure()` replaces the full configuration. Pass every integration that the app uses in each call.

## Expo Image

Docs: https://docs.expo.dev/eas/observe/integrations/expo-image/

**Requirements:** `expo-image` 57.0.2 or later (SDK 57+). If `expo-observe` is not installed, the integration does nothing. Only images loaded through `expo-image` are reported.

On every image load, the integration compares the decoded pixel area with the physical pixel count of the screen. When the area is larger than the screen's pixel count by more than `oversizeThreshold`, it logs an `expo-image.oversized` event with `warn` severity. Each image URL is reported at most once per app session.

**Options:**

| Option | Type | Default | What it does |
|---|---|---|---|
| `oversizeThreshold` | number | `1.5` | Report an image when its decoded pixel area is larger than the screen's physical pixel count by more than this factor. |
| `includeUrlParams` | boolean | `false` | Report the query string and fragment of the URL. Leave it `false` when the URLs can carry tokens or API keys. |

```tsx
Observe.configure({
  integrations: { 'expo-image': { oversizeThreshold: 2 } },
});
```

**Event attributes:** `url` (sanitized), `urlSanitized` (whether sanitization changed the URL), `imageWidth` and `imageHeight` (decoded pixels), `screenWidth` and `screenHeight` (points), and `pixelRatio`.

**URL sanitization:** basic-auth credentials are always removed. The query string and fragment are removed unless `includeUrlParams` is `true`. Only `http(s)`, `file`, and `android.resource` URLs are reported. Other schemes, such as `data:` and `ph://`, are never sent.

**Platform differences** for the `<Image>` component:

- On Android, `<Image>` downscales to the component size at decode time, so a large source in a small component is usually not reported.
- On iOS, the integration sees the decoded size of the source before downscaling, so a large source in a small component is reported, also with `allowDownscaling`.
- `useImage` and `Image.loadAsync` decode at the full source size on both platforms, unless the `maxWidth` and `maxHeight` load options are set.

**Fix reported images:** serve images close to their display size, for example resized variants from an image CDN. With `useImage`, set `maxWidth` and `maxHeight` to downscale at decode time.

```bash
npx --yes eas-cli@latest observe:events expo-image.oversized
```

## Reanimated

Docs: https://docs.expo.dev/eas/observe/integrations/react-native-reanimated/

**Requirements:** `react-native-reanimated` 4.7.0 or later (SDK 58+), and an `expo-observe` version that includes the integration. The integration uses the `onLog` callback of `configureReanimatedLogger`, which Reanimated 4.7.0 added. With an earlier Reanimated, or without Reanimated, the integration prints a console warning and does nothing. `react-native-reanimated` is an optional peer dependency of `expo-observe`, and it is loaded only when the integration is on.

**Do not call `configureReanimatedLogger` in the app.** The integration calls it itself:

- A call after `Observe.configure()` removes the integration's callback, and reporting stops.
- A call before `Observe.configure()` loses its `level` and `strict` options, because the integration replaces them.

To set those options, pass them to the integration. If the app already calls `configureReanimatedLogger`, move its options into the integration config and delete the call.

**Options:**

| Option | Type | Default | What it does |
|---|---|---|---|
| `level` | `ReanimatedLogLevel.warn` or `ReanimatedLogLevel.error` | `ReanimatedLogLevel.warn` | The minimum log level that Reanimated prints and reports. |
| `strict` | boolean | `true` | Whether Reanimated also prints and reports its strict-mode warnings. |
| `reportWarnings` | boolean | `false` | Also report Reanimated warnings as `reanimated.warning` events. |

```tsx
import { Observe } from 'expo-observe';
import { ReanimatedLogLevel } from 'react-native-reanimated';

Observe.configure({
  integrations: {
    'react-native-reanimated': {
      level: ReanimatedLogLevel.warn,
      strict: true,
      reportWarnings: true,
    },
  },
});
```

**What it reports:**

- A Reanimated error becomes a non-fatal error named `reanimated.error`. It appears on the **Observe > Errors** page with the other errors. On the React Native runtime, the stack trace starts in Reanimated's logger and then includes the code that called the logger. On the UI runtime, the error has the message but no stack trace.
- When `reportWarnings` is `true`, a Reanimated warning becomes a `reanimated.warning` event with `warn` severity. The `message` attribute holds the first 500 characters of the warning.
- Reanimated still prints all errors and warnings to the console.

**Limits:** some messages, such as `measure()` warnings, can repeat on every frame. In each 15-minute period, each distinct message is reported at most once, and at most 20 distinct errors and 20 distinct warnings are reported. Errors and warnings have separate limits. Messages are compared by their first 500 characters.

**Turn it off:** call `Observe.configure()` again without `'react-native-reanimated'`. Reporting stops, and Reanimated's logger keeps its `level` and `strict` options. This is different from the navigation integrations, which throw when their flag changes after mount. So a later `configure()` call must keep the same navigation integration flags.

```bash
# Errors, including reanimated.error
npx --yes eas-cli@latest observe:errors

# Warnings, when reportWarnings is true
npx --yes eas-cli@latest observe:events reanimated.warning
```
metrics.md 8.5 KB
# EAS Observe metrics — interpretation cheatsheet

Quick reference for reading EAS Observe dashboards and CLI output.

> Source: https://docs.expo.dev/eas/observe/reference/metrics/ — this is the canonical reference for metrics. Consult this page for the latest guidance, full prose definitions, optimization tips, and rationale.

All durations are in seconds. Metric data is retained for a minimum of 60 days. By default, every installation dispatches all of its events; high-volume apps can sample per installation with `configure({ sampleRate })` — see [Sampling](https://docs.expo.dev/eas/observe/configuration/#sampling).

## Target thresholds

| Metric | Full name | Target | Auto-collected? |
|---|---|---|---|
| Cold launch | `expo.app_startup.cold_launch_time` | **< 1.5s** | Yes (native-only — JS code does not affect it) |
| Warm launch | `expo.app_startup.warm_launch_time` | **< 0.5s** | Yes (OS decides when warm vs cold happens) |
| Bundle load | `expo.app_startup.bundle_load_time` | **< 0.3s** | Yes (JS load + evaluation, before `runApplication`) |
| Time to first render (TTR) | `expo.app_startup.ttr` | **< 2s** incl. cold launch | Yes when root is wrapped with `AppMetricsRoot` (SDK 55) / `ObserveRoot` (SDK 56+) |
| Time to interactive (TTI) | `expo.app_startup.tti` | **< 3s** incl. cold launch | **No** — call `markInteractive()` once the screen is genuinely usable |

Both TTR and TTI are measured *from native launch* through the React render, so the cold-launch portion counts against them.

## Interpreting TTI events (automatic params)

Every TTI event carries automatic params in three groups: frame rate, device state, and network state. Read the frame-rate group to classify *what kind* of slowness you're seeing, then read the device and network groups to decide whether the cause is the code or the conditions.

### Frame rate — what kind of slowness

| Param | Definition | What it indicates |
|---|---|---|
| `expo.frameRate.slowFrames` | Count of frames ≥ 17ms | Main thread consistently busy during launch (heavy layout, sync bridge calls, too many components rendering) |
| `expo.frameRate.frozenFrames` | Count of frames ≥ 700ms | Hard freezes. Even one during startup is a serious issue (sync I/O, large JSON parsing, blocking network) |
| `expo.frameRate.totalDelay` | Total accumulated time (seconds) frames exceeded their target duration | Best single "smoothness" number — compare to TTI |

**Diagnostic patterns:**

- **High TTI + low totalDelay** → slow but smooth. The launch sequence itself is long. Optimize bundle size, data-fetch waterfalls, initialization chains.
- **High TTI + high totalDelay + many slowFrames** → main-thread contention. Offload work, simplify the initial render tree.
- **High TTI + high totalDelay + any frozenFrames** → something is blocking hard. Look for synchronous I/O, large JSON parsing, or blocking network calls.

### Device state — is the regression environmental?

| Param | Type | What it indicates |
|---|---|---|
| `expo.device.lowPowerMode` | boolean | OS power saver was active (Low Power Mode on iOS, Battery Saver on Android). It throttles CPU, GPU, and background work. A regression that disappears when you filter this out is environmental, not a code change. |
| `expo.device.thermalState` | `nominal` \| `fair` \| `serious` \| `critical` \| `unknown` | Sustained `serious`/`critical` means the OS is throttling. Startup slows independently of any app change. |
| `expo.device.batteryLevel` | number, 0–1 | Fractional charge at TTI. Rules out throttling on devices that manage performance aggressively at low charge. Omitted when the OS reports no value. |
| `expo.device.batteryCharging` | boolean | Charging raises sustained CPU ceilings on iOS and some Android OEMs. Non-charging samples are the more conservative population. |

### Network state — is startup network-bound?

| Param | Type | What it indicates |
|---|---|---|
| `expo.network.connected` | boolean | If TTI degrades only when `true`, startup is network-bound. If it degrades when `false`, the app does too much before showing cached content. |
| `expo.network.type` | `wifi` \| `cellular` \| `ethernet` \| `none` \| `other` \| `unknown` | Compare cellular against Wi-Fi. A large gap points to network-bound startup work. VPN traffic reports the underlying transport. The value set is identical on both platforms, so dashboards need no per-platform branching. |
| `expo.network.isExpensive` | boolean | Both platforms. The OS considers the connection metered (cellular, hotspot). Present only when a network exists. |
| `expo.network.isConstrained` | boolean | **iOS only.** Low Data Mode is on for this path, so the system defers background transfers. |
| `expo.network.dataSaverEnabled` | boolean | **Android only.** Data Saver is on. It is the nearest equivalent of Low Data Mode, but process-wide rather than per-path, hence the separate key. |

### Network requests — was the network the cause?

TTI events summarize the HTTP requests made during launch, from the end of the native launch to the `markInteractive()` call. Traffic is observed automatically — `URLSession` on iOS, `OkHttpClient` on Android, which covers `fetch` — and Observe's own uploads are excluded. All of these are omitted when the window held no requests.

| Param | Unit | What it indicates |
|---|---|---|
| `expo.network.requests.count` | count | Requests that finished in the window. A request still in flight when the app became interactive is not counted anywhere in this table. |
| `expo.network.requests.failed` | count | Errored, returned 4xx/5xx, never got a response, or broke partway through the body. Redirects are not failures. |
| `expo.network.requests.bytesReceived` / `.bytesSent` | bytes | On-the-wire totals for the window. |
| `expo.network.requests.totalDuration` | seconds | Sum of every request duration, failures included. Exceeds wall-clock when requests overlap; one timeout contributes the client's full timeout interval. |
| `expo.network.requests.throughputBytesPerSecond` | bytes/sec | Received bytes over the time bytes were actually moving (union of transfer windows, measured from each first byte). Excludes DNS, connect, server think time, cache hits, and failures. Requests the OS did not clearly identify as network loads are excluded too. Omitted when nothing was received. |
| `expo.network.requests.slowest.duration` | seconds | The single longest **completed** request. Requests that never produced a response are excluded, since a timeout measures the client's own setting. |
| `expo.network.requests.slowest.host` | string | Host of that request. |
| `expo.network.requests.slowest.statusCode` | number | Explains an empty response: `bytesReceived` of 0 is routine on a 304, a problem on a 200. |
| `expo.network.requests.slowest.timeToFirstByte` | seconds | Includes server processing, so treat it as a proxy for network quality, not a measurement of it. |
| `expo.network.requests.slowest.bytesReceived` | bytes | Separates "slow because it moved a lot of data" from "slow while idle". |

**Diagnostic patterns:**

- **`slowest.duration` mostly `timeToFirstByte`** → the server was slow to answer. Optimize the endpoint, or stop blocking startup on it.
- **Small `timeToFirstByte` + large `bytesReceived`** → the transfer itself was slow. Shrink the payload or defer it.
- **High `failed` + high `totalDuration`** → the launch burned time on requests that never arrived. Add timeouts and render cached content first.
- **Low `throughputBytesPerSecond` on `wifi`** → suspect the population, not the code; cross-check `isExpensive` and `isConstrained` / `dataSaverEnabled`.

> The summary is bounded by an in-memory ring buffer of the 200 most recent requests. A launch that makes more undercounts, so read these as a sample of a very busy window.

### Custom params

You can attach your own params to the TTI event, and override the route name it is tagged with. See [`./setup.md`](./setup.md) for the call syntax.

## Dispatch caveats

- **Debug builds** (native debug OR JS bundle with `__DEV__` = true) do **not** dispatch metrics unless `configure({ dispatchInDebug: true })` is set.
- The `environment` tag (defaults to `process.env.NODE_ENV`) is metadata only — it does not gate dispatch by itself.
- Offline events are buffered on-device and flushed when the app backgrounds or `Observe.dispatchEvents()` is called.

## Cross-references

- Full metric definitions and optimization guidance: https://docs.expo.dev/eas/observe/reference/metrics/
- Setup steps (`AppMetricsRoot` / `ObserveRoot`, `markInteractive`): see [`./setup.md`](./setup.md).
- Querying metrics via the EAS CLI: see [`./queries.md`](./queries.md).
queries.md 27.6 KB
# EAS Observe CLI

EAS Observe collects app performance telemetry and custom events from Expo apps and exposes them through the `eas observe:*` commands. The CLI changes between releases, so treat `--help` as the source of truth: run `eas observe --help` to list the commands the installed CLI has, and `eas observe:<command> --help` for a command's current flags.

> Source: https://docs.expo.dev/eas/observe/eas-cli/ — the canonical CLI page. This reference adds table layouts, JSON output shapes, and pagination details that the docs page does not cover.

## Commands Overview

| Command | Purpose |
|---------|---------|
| `npx --yes eas-cli@latest observe:metrics-summary` | Per-version statistical aggregates for startup and navigation metrics (median, p90, etc.) |
| `npx --yes eas-cli@latest observe:metrics` | Individual metric samples ordered by value or timestamp (paginated) |
| `npx --yes eas-cli@latest observe:routes` | Per-route statistical aggregates for navigation metrics (Nav Cold TTR, Nav Warm TTR, Nav TTI) |
| `npx --yes eas-cli@latest observe:events` | Custom events emitted by the app via `logEvent` — name summary, all events, or filtered by event name (paginated) |
| `npx --yes eas-cli@latest observe:session` | Full timeline of metric events, log events, and trace spans for one session |
| `npx --yes eas-cli@latest observe:versions` | App version hierarchy with build numbers, OTA update IDs, and event counts |
| `npx --yes eas-cli@latest observe:errors` | Error groups by fingerprint; `--fingerprint <id>` lists one group's occurrences with stack traces |
| `npx --yes eas-cli@latest observe:traces` | Network request trace spans: a summary of span names and kinds, or individual spans with span filters or `--all-spans` (paginated) |
| `npx --yes eas-cli@latest observe:trace` | Every span of one trace by its trace ID, with child spans indented under their parent |
| `npx --yes eas-cli@latest observe:event` | One metric, log, or error event by its ID, taken from the `--json` output of `observe:session`, `observe:metrics`, or `observe:events`, or from the occurrences listed by `observe:errors --fingerprint` |

All commands take these flags:

- `--project-id <id>` — run against a specific project without needing a project directory. When passed, the command will not try to create a new EAS project where one is unneeded.
- `--json` — machine-readable output (implies `--non-interactive`)
- `--non-interactive` — fail instead of prompting

All commands **except `observe:event` and `observe:trace`** also take these flags:

- `--start <ISO date>` and `--end <ISO date>` — explicit time range
- `--days <N>` — show data from the last N days (mutually exclusive with `--start`/`--end`, minimum 1)
- `--environment <name>` — filter by environment, for example `production` or `development`

`--platform <android|ios|ipados|macos|tvos|apple>` (default: all) is on every command **except `observe:session`, `observe:event`, and `observe:trace`**, which are scoped to one session, event, or trace already. `apple` covers iOS, iPadOS, tvOS, and macOS.

Default time range is the last 60 days when none of `--days`, `--start`, `--end` is given.

**Plan gating.** Observe is a paid feature, and the server rejects queries the account's plan does not include (`EAS_OBSERVE_PLAN_UPGRADE_REQUIRED` or `EAS_OBSERVE_FEATURE_NOT_AVAILABLE_IN_FREE_TIER`). The CLI surfaces the server's upgrade message, which links to the account's billing page. Session timelines in particular are checked before the interactive picker runs. A plan-gate failure is not a bug in the command or its flags.

## Expo MCP Server tools

> Source: https://docs.expo.dev/eas/observe/ai-agents/

The Expo MCP Server has read-only tools that return the same data as the CLI. When the `observe_*` tools are available, use them instead of the CLI: they use the Expo account that the MCP client signed in with, so they need no EAS CLI install and no access token. The queries, metric names, and workflows in this file apply to both.

| Tool | CLI equivalent |
|---|---|
| `observe_versions` | `eas observe:versions` |
| `observe_metrics_summary` | `eas observe:metrics-summary` |
| `observe_metrics` | `eas observe:metrics` |
| `observe_routes` | `eas observe:routes` |
| `observe_event_names` | `eas observe:events` (name summary) |
| `observe_events` | `eas observe:events <name>`, or `--all-events` without `eventName` |
| `observe_session` | `eas observe:session` |
| `observe_errors` | `eas observe:errors` |
| `observe_error_occurrences` | `eas observe:errors --fingerprint <id>` |
| `observe_error_breakdown` | None. Splits one error group by `APP_VERSION`, `OS`, `DEVICE`, or `COUNTRY`. |
| `observe_span_names` | `eas observe:traces` (name summary) |
| `observe_spans` | `eas observe:traces` with span filters or `--all-spans` |
| `observe_trace` | `eas observe:trace <trace-id>` |

Differences from the CLI:

- **Errors:** `observe_errors`, `observe_error_occurrences`, and `observe_error_breakdown` take `kind` (`JS`, `NATIVE`, or `OTHER`), which the CLI does not have. `observe_errors` also takes `orderBy` (`MOST_FREQUENT`, `MOST_USERS`, `FIRST_SEEN`, or `LAST_SEEN`) and `severity` in uppercase (`FATAL` or `ERROR`), where the CLI takes `--severity fatal` or `--severity error`. `observe_error_occurrences` can filter by `sessionId` without a fingerprint, and takes `sort` (`newest` or `oldest`). `observe_error_breakdown` requires `fingerprint` and `dimension`.
- **Spans:** `observe_spans` takes arrays (`names`, `hosts`, `httpStatusCodes`) and uppercase enum values (`kinds`, `statusCodes`) where the CLI repeats a lowercase flag. It also takes `scopes`, such as `expo-observe.network`, and `sort` (`newest` or `oldest`).
- **Project:** pass `appId` or `appFullName` (such as `@owner/my-app`). In a project directory, read the project ID from the app config.
- **Platform:** `platform` takes `ANDROID`, `IOS`, `IPADOS`, `MACOS`, or `TVOS`. There is no `apple` value. As in the CLI, `observe_versions`, `observe_metrics_summary`, and `observe_routes` return separate Android and iOS results without `platform`, and `observe_metrics`, `observe_event_names`, and `observe_events` return results from all platforms.
- **Environment:** `observe_event_names`, `observe_events`, the error tools, `observe_span_names`, and `observe_spans` take `environment`. `observe_versions`, `observe_metrics_summary`, `observe_metrics`, and `observe_routes` have no environment input, unlike the CLI's `--environment` flag.
- **Time range:** `days` (up to 365), or `start` and `end`. The default is the last 60 days. `start` and `end` must be ISO 8601 date-times with a timezone, such as `2026-10-01T00:00:00Z`. A date-only value fails. Unlike the CLI, `end` does not need `start`. `observe_session` and `observe_trace` take no time range.
- **Pagination:** pass `pageInfo.endCursor` from a response back as `nextCursor`. For `observe_metrics`, `observe_events`, `observe_routes`, `observe_spans`, and `observe_error_occurrences`, also pass the returned `startTime` and `endTime` as `start` and `end`, and keep the other inputs the same. Routes paginate per platform. Session timelines paginate metrics, logs, and spans separately.
- **Plan gating and usage:** plan limits are the same as for the CLI. Each tool call counts toward the account's Expo MCP Server usage.
- **Defaults and limits:** `observe_metrics` sorts `newest` first by default. The CLI's `--sort` defaults to `oldest`. `observe_routes` takes a `limit` of up to 100, and the CLI takes up to 200. `observe_events` takes `sort`, and the CLI's `observe:events` has no `--sort`.

## Supported Metrics

### App-startup metrics

| Alias | Full name | Display |
|-------|-----------|---------|
| `tti` | `expo.app_startup.tti` | Startup TTI (time to interactive) |
| `ttr` | `expo.app_startup.ttr` | Startup TTR (time to render) |
| `cold_launch` | `expo.app_startup.cold_launch_time` | Cold Launch |
| `warm_launch` | `expo.app_startup.warm_launch_time` | Warm Launch |
| `bundle_load` | `expo.app_startup.bundle_load_time` | Bundle Load |
| `update_download` | `expo.updates.download_time` | Update Download |

### Navigation metrics

Emitted only when a navigation integration is enabled (SDK 56+). Measured per route name.

| Alias | Full name | Display |
|-------|-----------|---------|
| `nav_cold_ttr` | `expo.navigation.cold_ttr` | Nav Cold TTR |
| `nav_warm_ttr` | `expo.navigation.warm_ttr` | Nav Warm TTR |
| `nav_tti` | `expo.navigation.tti` | Nav TTI |

**Which command takes which alias.** `observe:metrics` (positional argument) and `observe:metrics-summary --metric` accept **all nine** aliases — startup and navigation. `observe:routes --metric` accepts only the three navigation aliases. Use the `nav_` prefix everywhere; there are no bare `cold_ttr` / `warm_ttr` aliases.

`observe:metrics` also accepts a full metric name in place of an alias, for example `npx --yes eas-cli@latest observe:metrics expo.app_startup.tti`. `observe:routes` accepts full navigation names the same way. The `--metric` flags on `metrics-summary` and `routes` are strict oclif options, so they take aliases only.

## `eas observe:metrics-summary`

Shows per-version statistical aggregates for one or more metrics, with separate tables per platform.

```bash
# All default metrics, last 60 days, both platforms
npx --yes eas-cli@latest observe:metrics-summary

# Single metric
npx --yes eas-cli@latest observe:metrics-summary --metric tti

# Multiple metrics — each renders as its own table
npx --yes eas-cli@latest observe:metrics-summary --metric tti --metric cold_launch

# Navigation metrics aggregate per version here, per route in observe:routes
npx --yes eas-cli@latest observe:metrics-summary --metric nav_tti

# Choose which statistics to display
npx --yes eas-cli@latest observe:metrics-summary --metric tti --stat median --stat p90 --stat eventCount

# Narrow time range and platform
npx --yes eas-cli@latest observe:metrics-summary --metric tti --days 14 --platform ios
```

**Stat flags:** exactly `min`, `median`, `max`, `average`, `p80`, `p90`, `p99`, `eventCount`. This command takes **no aliases** — `med`, `avg`, and `count` are rejected here (they work only on `observe:routes`).

**Default stats:** `median` + `eventCount` in the table; all eight in JSON.

This command has no `--limit`, `--after`, `--app-version`, `--build-number`, or `--update-id`. It always aggregates every version in the time range.

**Table layout:**
- One table per metric (with merged value + event count cells, e.g. `0.45s (150)`)
- Each table shows iOS and Android in separate sections
- App Version column includes build numbers in parentheses (e.g. `1.2.0 (42)`)
- Footer row per platform shows total events per metric
- **Update IDs are omitted from the table** to keep output readable when a version has many updates; they are included in the JSON output as an array per version

**JSON output shape:**
```json
{
  "versions": [
    {
      "appVersion": "1.2.0",
      "platform": "IOS",
      "buildNumbers": ["42"],
      "updateIds": ["abc-def-...", "..."],
      "metrics": {
        "expo.app_startup.tti": { "median": 0.45, "p90": 0.9, "...": "..." }
      }
    }
  ],
  "totalEventCounts": {
    "expo.app_startup.tti": { "IOS": 1234, "ANDROID": 890 }
  }
}
```

## `eas observe:metrics`

Shows individual performance metric samples, paginated. The metric is a positional argument, not a flag. If omitted and running interactively, prompts for selection; in non-interactive mode it throws an error.

```bash
# Interactive: prompts for metric
npx --yes eas-cli@latest observe:metrics

# Specify metric as positional arg
npx --yes eas-cli@latest observe:metrics tti

# Navigation metrics work here too
npx --yes eas-cli@latest observe:metrics nav_tti --sort slowest

# Filter by version or update, sort by slowest
npx --yes eas-cli@latest observe:metrics tti --app-version 1.2.0 --sort slowest --limit 20

# Pagination — pass the endCursor from the previous run
npx --yes eas-cli@latest observe:metrics tti --after <cursor>
```

**Sample-specific flags:**
- `--sort <oldest|newest|slowest|fastest>` — defaults to `oldest`
- `--limit <N>` — samples per page (default 10, max 100)
- `--after <cursor>` — pagination cursor from the previous run
- `--app-version <version>` — filter by app version string
- `--build-number <number>` — filter by app build number
- `--update-id <id>` — filter by EAS update ID

**Table layout:**
- Summary header shows the metric name, time range, and total sample count across all versions (e.g. `TTI samples for the last 60 days — 1,234 total events`)
- Columns: Value, App Version (with build number), Update (only when any sample has one), Platform, Device, Country, Timestamp
- When `hasNextPage` is true, prints `Next page: --after <endCursor>` hint below the table
- JSON output also includes `sessionId`, `easClientId`, and a `customParams` object per sample

## `eas observe:routes`

Shows per-route statistical aggregates for navigation metrics (Cold TTR, Warm TTR, Nav TTI), grouped by route name with separate sections per platform.

```bash
# All three navigation metrics, default stats, last 60 days, both platforms
npx --yes eas-cli@latest observe:routes

# Single metric, last 7 days, iOS only
npx --yes eas-cli@latest observe:routes --metric nav_tti --days 7 --platform ios

# Multiple metrics and stats
npx --yes eas-cli@latest observe:routes --metric nav_cold_ttr --metric nav_warm_ttr --stat median --stat p90 --stat count

# Filter to a single build
npx --yes eas-cli@latest observe:routes --app-version 1.2.0 --build-number 42

# Narrow to specific routes (repeat the flag for multiple routes)
npx --yes eas-cli@latest observe:routes --route-name /new --route-name /settings

# Pagination — each platform has its own cursor; pass the relevant endCursor
npx --yes eas-cli@latest observe:routes --after <cursor>
```

**Routes-specific flags:**
- `--metric <nav_cold_ttr|nav_warm_ttr|nav_tti>` — navigation metric(s) to display, can be repeated. Defaults to all three.
- `--stat <median|p90|count>` — statistic(s) per metric. Aliases: `med` → `median`, `event_count` / `eventCount` → `count`.
- `--limit <N>` — routes per page (default **50**, max **200**, different from `metrics`/`events` which default to 10).
- `--after <cursor>` — pagination cursor from the previous run.
- `--app-version <version>` — filter by app version string.
- `--build-number <number>` — filter by app build number.
- `--route-name <name>` — filter by route name. Repeatable; only the listed routes are returned across both platforms. Duplicates are de-duplicated; omitting the flag returns all routes.
- `--update-id <id>` — filter by EAS update ID.

**Default stats:** `median` + `count` in the table; `median`, `p90`, `count` in JSON.

**Table layout:**
- Summary header with the chosen stats and time range, e.g. `Med, P90 values (navigation count) for the last 7 days`.
- Separate iOS and Android sections.
- First column is **Route**, followed by one column per metric/stat. With both display stats and `count`, cells are merged like `0.32s (1240)`.
- Each platform has its own pagination hint: `Next page (iOS): --after <endCursor>`.

**JSON output shape:**
```json
{
  "routes": [
    {
      "routeName": "(tabs)/home",
      "platform": "IOS",
      "metrics": {
        "expo.navigation.cold_ttr": { "median": 0.32, "p90": 0.85, "count": 1240 },
        "expo.navigation.tti":       { "median": 0.55, "p90": 1.10, "count": 1240 }
      }
    }
  ],
  "pageInfoByPlatform": {
    "IOS":     { "hasNextPage": true,  "endCursor": "..." },
    "ANDROID": { "hasNextPage": false, "endCursor": null }
  }
}
```

## `eas observe:events`

Shows custom events emitted by the app via the `logEvent` API in `expo-observe`. Behavior depends on what is passed:

| Invocation | Result |
|---|---|
| `observe:events` | Summary table of available event names with counts |
| `observe:events --all-events` | Full list of events across **all** event names |
| `observe:events <event-name>` | Full list of events filtered by that event name |

```bash
# List the available custom event names and their counts (last 60 days)
npx --yes eas-cli@latest observe:events

# All events across all names, last 7 days, iOS only
npx --yes eas-cli@latest observe:events --all-events --days 7 --platform ios

# Only events with the given name
npx --yes eas-cli@latest observe:events login_failed --limit 50

# Drill into a single session
npx --yes eas-cli@latest observe:events --all-events --session-id <session-id>

# Pagination
npx --yes eas-cli@latest observe:events login_failed --after <cursor>
```

**Events-specific flags:**
- `--all-events` — when no event name argument is given, list all events instead of the name summary. Cannot be combined with an event name argument.
- `--session-id <id>` — filter to events from a single session (events-only). With no event name argument, this lists the session's events instead of the event-name summary. For the full timeline — metrics as well as log events — use `observe:session`.
- `--app-version <version>` — filter by app version string
- `--build-number <number>` — filter by app build number
- `--update-id <id>` — filter by EAS update ID
- `--limit <N>` — events per page (default 10, max 100)
- `--after <cursor>` — pagination cursor

**Table layout (event listings):**
- Summary header: `<event-name> events <time range>` or `Custom events <time range>` for `--all-events`, with a total event count when available
- Columns: Timestamp, Event (only when listing across multiple names), Severity (only when at least one event in the page has a severity), App Version (with build number), Platform, Device, Country
- `Next page: --after <endCursor>` hint below the table when there is a next page

**Empty-result helper:** if a specific event name is queried and returns no events, the command prints a yellow `No events found matching "<name>"` warning followed by the available event names + counts in the same time range — useful for fixing typos.

**Truncation note:** the event-names summary may flag `Result is truncated; not all event names are shown.` when there are more names than the server returns in a single response.

**JSON output shape (event listing):**
```json
{
  "events": [
    {
      "id": "...",
      "eventName": "login_failed",
      "timestamp": "2026-...",
      "sessionId": "...",
      "severityNumber": 13,
      "severityText": "WARN",
      "properties": [{ "key": "reason", "value": "bad_password", "type": "string" }],
      "appVersion": "1.2.0",
      "appBuildNumber": "42",
      "appUpdateId": null,
      "appEasBuildId": null,
      "deviceModel": "...",
      "deviceOs": "iOS",
      "deviceOsVersion": "17.4",
      "countryCode": "US",
      "environment": "production",
      "easClientId": "..."
    }
  ],
  "pageInfo": { "hasNextPage": true, "endCursor": "..." }
}
```

The name-summary mode returns `{ "names": [{ "eventName": "...", "count": 123 }], "isTruncated": false }`.

## `eas observe:session`

Shows the full timeline of metric events, log events, and trace spans for a single session — the CLI equivalent of the dashboard's session view. Use it after `observe:metrics` surfaces a slow sample: take that sample's `sessionId` (present in `--json` output) and replay everything that session recorded.

```bash
# Interactive: pick a metric, then pick a session from the candidate list
npx --yes eas-cli@latest observe:session

# Inspect a known session
npx --yes eas-cli@latest observe:session <session-id>

# Pick a session from the slowest TTI events in the last 7 days
npx --yes eas-cli@latest observe:session --event-name tti --sort slowest --days 7
```

**Session-specific flags:**
- `[SESSIONID]` — positional. Omit it in interactive mode to choose from a list. **Required in non-interactive mode**, including under `--json`.
- `--event-name <name>` — metric or log event used to build the candidate session list (for example `tti`, `cold_launch`, `login_pressed`). Prompts when omitted in interactive mode.
- `--sort <slowest|fastest|newest|oldest>` — orders the candidate events. Prompts when omitted in interactive mode. No default, unlike `observe:metrics`.

**The picker flags and the session ID are mutually exclusive.** `--event-name`, `--sort`, `--days`, `--start`, and `--end` describe how to *find* a session, so passing any of them together with a session ID throws. Query a known session with the ID alone.

This command has no `--platform`, `--limit`, or `--after` flag. It takes the shared time-range, `--environment`, `--project-id`, `--json`, and `--non-interactive` flags.

**JSON output shape:**
```json
{
  "sessionId": "...",
  "metadata": { "...": "..." },
  "entries": [{ "...": "..." }],
  "hasMoreMetricEvents": false,
  "hasMoreLogEvents": false,
  "hasMoreSpans": false
}
```

`entries` interleaves metric events, log events, and spans for the session. Each stream shows at most 100 entries. The three `hasMore*` flags report truncation per stream; there is no cursor to page with.

## `eas observe:errors`

Shows error and exception groups, grouped by fingerprint, with event, user, and session counts for each group. The fingerprint is in the first column. Pass `--fingerprint` to list the occurrences of one group, with stack traces, instead of the grouped summary. Error reporting setup is in [`./setup.md`](./setup.md).

```bash
# Error groups, last 7 days
npx --yes eas-cli@latest observe:errors --days 7

# Only fatal errors on Android
npx --yes eas-cli@latest observe:errors --severity fatal --platform android

# Occurrences of one group, with stack traces
npx --yes eas-cli@latest observe:errors --fingerprint <fingerprint>
```

**Errors-specific flags:**
- `--fingerprint <value>` — show the occurrences of this error group instead of the grouped summary
- `--severity <fatal|error>` — filter by severity (ignored when `--fingerprint` is set)
- `--app-version <version>`, `--build-number <number>`, `--update-id <id>` — filter by version, build, or EAS update
- `--limit <N>` — occurrences per page (default 10, max 100). Requires `--fingerprint`.
- `--after <cursor>` — pagination cursor. Requires `--fingerprint`.

`--limit` or `--after` without `--fingerprint` fails with an error. The grouped summary has no pagination.

## `eas observe:traces`

Shows network request spans that the app recorded with the `networkTraces` option (setup is in [`./setup.md`](./setup.md)), newest first. With no span filter, it shows a summary of span names (HTTP methods such as `GET` or `POST`) and kinds, with counts. A span filter or `--all-spans` lists individual spans instead, with their trace IDs.

```bash
# Span names and counts, last 7 days
npx --yes eas-cli@latest observe:traces --days 7

# Failed requests
npx --yes eas-cli@latest observe:traces --status error --days 7

# Slow requests to one host
npx --yes eas-cli@latest observe:traces --host api.example.com --min-duration 1000

# Server errors, only root spans
npx --yes eas-cli@latest observe:traces --http-status 500 --http-status 503 --root-only

# The requests of one session
npx --yes eas-cli@latest observe:traces --session-id <session-id>
```

**Traces-specific flags:**
- `--name <name>` — span name, such as `GET` (repeatable)
- `--kind <client|consumer|internal|producer|server|unspecified>` — span kind (repeatable)
- `--status <error|ok|unset>` — span status (repeatable)
- `--host <host>` — request host (repeatable)
- `--http-status <code>` — HTTP response status code (repeatable)
- `--min-duration <ms>` — only spans that took at least this many milliseconds
- `--root-only` — only spans with no parent
- `--session-id <id>` — only spans from one session
- `--all-spans` — list individual spans even with no span filter
- `--app-version <version>`, `--build-number <number>`, `--update-id <id>` — filter by version, build, or EAS update
- `--limit <N>` — spans per page (default 20, max 100)
- `--after <cursor>` — pagination cursor. It also selects the span list.

## `eas observe:trace`

Shows every span of one trace, oldest first, with child spans indented under their parent. The table columns are **Offset, Duration, Name, Status, HTTP, URL**. Trace IDs are in the `observe:traces` span list.

```bash
npx --yes eas-cli@latest observe:trace <trace-id>
npx --yes eas-cli@latest observe:trace <trace-id> --json
```

`traceId` is a required positional argument. The command takes only `--project-id`, `--json`, and `--non-interactive`. In `--json` output, a span with no `parentSpanId` is a root span, and a span with no `http` object is not an HTTP request.

## `eas observe:event`

Shows one metric, log, or error event by its ID. Event IDs are in the `--json` output of `observe:metrics`, `observe:events`, and `observe:session`, and in the occurrences from `observe:errors --fingerprint`.

```bash
npx --yes eas-cli@latest observe:event <event-id>
npx --yes eas-cli@latest observe:event <event-id> --json
```

`ID` is a required positional argument. The command takes only `--project-id`, `--json`, and `--non-interactive`.

## `eas observe:versions`

Shows app version hierarchy with build numbers, OTA update IDs, and event counts per version.

```bash
# Both platforms, last 60 days
npx --yes eas-cli@latest observe:versions

# iOS only, last 14 days
npx --yes eas-cli@latest observe:versions --days 14 --platform ios
```

No metric-related flags. Output shows separate iOS and Android tables with columns: **App Version, First Seen, Events, Users, Builds (count), Updates (count)**.

JSON output returns the full nested hierarchy with `buildNumbers[].easBuilds[]` and `updates[].easBuilds[]`, including `firstSeenAt`, `eventCount`, and `uniqueUserCount` at every level.

## Common Workflows

**"What are my app's startup times right now?"**
```bash
npx --yes eas-cli@latest observe:metrics-summary --days 7 --stat median --stat p90
```

**"Which TTI samples were slowest this week?"**
```bash
npx --yes eas-cli@latest observe:metrics tti --sort slowest --days 7 --limit 20
```

**"How fast are over-the-air updates downloading in the field?"**
```bash
npx --yes eas-cli@latest observe:metrics-summary --metric update_download --days 7
```

**"Which screens are slowest to navigate to?"**
```bash
npx --yes eas-cli@latest observe:routes --metric nav_tti --stat median --stat p90 --days 7
```

**"What happened during that one slow session?"**
```bash
npx --yes eas-cli@latest observe:metrics tti --sort slowest --days 7 --json   # read sessionId from a sample
npx --yes eas-cli@latest observe:session <session-id>
```

**"How does navigation perform on just the routes I care about?"**
```bash
npx --yes eas-cli@latest observe:routes --route-name /home --route-name /checkout --days 7
```

**"What custom events is my app emitting?"**
```bash
npx --yes eas-cli@latest observe:events --days 7
```

**"Show me every error event from one user's session."**
```bash
npx --yes eas-cli@latest observe:events --all-events --session-id <session-id>
```

**"Which network requests are slow or failing?"**
```bash
npx --yes eas-cli@latest observe:traces --status error --days 7
npx --yes eas-cli@latest observe:traces --min-duration 2000 --days 7   # read a trace ID from a span
npx --yes eas-cli@latest observe:trace <trace-id>
```

**"What versions of my app are in the field?"**
```bash
npx --yes eas-cli@latest observe:versions
```

**"Show me metrics for a specific project without needing to be in the repo"**
```bash
npx --yes eas-cli@latest observe:metrics-summary --project-id <uuid> --metric tti
```

**"Get JSON for scripting"**
```bash
npx --yes eas-cli@latest observe:metrics-summary --metric tti --json --non-interactive
```

## Notes

- Requires the user to be logged in (`npx --yes eas-cli@latest login`).
- When `--project-id` is provided, the command does not require running inside an EAS project directory; otherwise the project ID is read from the local `app.config` / `app.json`. If using this option, ensure that you are logged in as a user that has access to the specified project.
- `observe:metrics-summary` does not print update IDs in the table but still returns them in JSON for scripting or piping into other commands.
setup.md 31.3 KB
# Set up EAS Observe in an existing project

EAS Observe collects app-startup performance metrics (cold launch, warm launch, bundle load, TTR, TTI) from production Expo apps. This reference summarizes the steps to add `expo-observe` to an existing project.

> Source: https://docs.expo.dev/eas/observe/get-started/ — consult this page for the latest guidance.

## SDK 55 vs SDK 56+ at a glance

The library exports differ between SDK versions. Pick the right one for the project's SDK before copying any snippet below.

| Concern | SDK 55 | SDK 56 and later |
|---|---|---|
| Root layout HOC | `AppMetricsRoot.wrap(...)` | `ObserveRoot.wrap(...)` |
| `markInteractive()` API | Global: `AppMetrics.markInteractive()` | Hook: `const { markInteractive } = useObserve()` |
| Import source | `expo-observe` | `expo-observe` (same package) |

Everything else — package name, build process, dashboard, debug-mode behavior — is the same across versions.

## Prerequisites

Before installing, confirm all of the following:

1. **An Expo account.** Sign up at [expo.dev/signup](https://expo.dev/signup) if needed.
2. **Expo SDK 55 or later.** Run `npx --yes @expo/agent-cli@latest doctor` to check, and `npx --yes @expo/agent-cli@latest install --fix` to update dependencies. SDK 56+ unlocks the newer `ObserveRoot` / `useObserve` API.
3. **An EAS project.** The app must have `extra.eas.projectId` set in its app config. If not, run `npx --yes eas-cli@latest init` to create one.
4. **A development build or a production build.** `expo-observe` is a native library, so it does **not** work in Expo Go. Testing the integration requires a [development build](https://docs.expo.dev/develop/development-builds/introduction/).

## Step 1 — Install the library

From the project root:

```sh
npx --yes @expo/agent-cli@latest install --fix
npx --yes @expo/agent-cli@latest install expo-observe
```

## Step 2 — Wrap the root layout

The HOC automatically measures **Time to First Render (TTR)**. Apply it to the file that exports the app's root component. The HOC name depends on the SDK version.

**SDK 55** — use `AppMetricsRoot`:

```tsx
// app/_layout.tsx
import { Stack } from 'expo-router';
import { AppMetricsRoot } from 'expo-observe';

function RootLayout() {
  return <Stack />;
}

export default AppMetricsRoot.wrap(RootLayout);
```

**SDK 56 and later** — use `ObserveRoot`:

```tsx
// app/_layout.tsx
import { Stack } from 'expo-router';
import { ObserveRoot } from 'expo-observe';

function RootLayout() {
  return <Stack />;
}

export default ObserveRoot.wrap(RootLayout);
```

**Without Expo Router** (`App.tsx`): wrap the default-exported `App` component the same way — `export default AppMetricsRoot.wrap(App);` on SDK 55, or `export default ObserveRoot.wrap(App);` on SDK 56+.

## Step 3 — Mark the app as interactive

TTI is **not** collected automatically. Signal it once the screen is genuinely ready for the user — i.e. after splash-screen-blocking work like update checks, authentication, initial data fetching, or splash animations finishes. Place the call in a `useEffect` that runs once that work resolves.

**SDK 55** — call the global `AppMetrics.markInteractive()`:

```tsx
// app/_layout.tsx
import { Stack } from 'expo-router';
import * as SplashScreen from 'expo-splash-screen';
import { AppMetrics, AppMetricsRoot } from 'expo-observe';
import { useEffect, useState } from 'react';

SplashScreen.preventAutoHideAsync();

function RootLayout() {
  const [isReady, setIsReady] = useState(false);

  useEffect(() => {
    async function prepare() {
      try {
        await authenticateUser();
        await fetchInitialData();
      } catch (e) {
        console.warn(e);
      } finally {
        setIsReady(true);
      }
    }
    prepare();
  }, []);

  useEffect(() => {
    if (isReady) {
      SplashScreen.hide();
      AppMetrics.markInteractive();
    }
  }, [isReady]);

  if (!isReady) return null;
  return <Stack />;
}

export default AppMetricsRoot.wrap(RootLayout);
```

**SDK 56 and later** — use the `useObserve()` hook to get a bound `markInteractive`:

```tsx
// app/_layout.tsx
import { Stack } from 'expo-router';
import * as SplashScreen from 'expo-splash-screen';
import { ObserveRoot, useObserve } from 'expo-observe';
import { useEffect, useState } from 'react';

SplashScreen.preventAutoHideAsync();

function RootLayout() {
  const [isReady, setIsReady] = useState(false);
  const { markInteractive } = useObserve();

  useEffect(() => {
    async function prepare() {
      try {
        await authenticateUser();
        await fetchInitialData();
      } catch (e) {
        console.warn(e);
      } finally {
        setIsReady(true);
      }
    }
    prepare();
  }, []);

  useEffect(() => {
    if (isReady) {
      SplashScreen.hide();
      markInteractive();
    }
  }, [isReady, markInteractive]);

  if (!isReady) return null;
  return <Stack />;
}

export default ObserveRoot.wrap(RootLayout);
```

**Without Expo Router:** the structure is the same in `App.tsx`. Use `SplashScreen.hideAsync()` instead of `SplashScreen.hide()` and replace `<Stack />` with the app's root tree.

### Multiple entry screens

`markInteractive()` is safe to call repeatedly — only the **first** call per session is recorded. If the app has more than one entry screen (onboarding, login, deep-link targets), call `markInteractive()` on **each one**. Otherwise TTI will be missing for sessions that open via a deep link to a screen without the call.

### Custom params and route name

`markInteractive()` accepts an options object. Use `params` to slice TTI by an app-specific dimension (cohort, tenant, feature-flag variant, cache hit). Use `routeName` to override the route the event is tagged with — useful when the logical screen name differs from the router path, when the route is dynamic, or when the app does not use Expo Router. Param values may be strings, numbers, booleans, or any JSON-serializable value.

```tsx
// SDK 56+: const { markInteractive } = useObserve();
// SDK 55:  AppMetrics.markInteractive({ ... })
markInteractive({
  routeName: '/feed',
  params: { tenant: 'acme', cohort: 'beta', cacheHit: true },
});
```

### Declarative alternative: `<ObserveInteractiveMarker />` (SDK 56+)

Instead of calling `markInteractive()` from an effect, render the marker component at the point the screen becomes interactive. It renders nothing and calls `markInteractive()` once on mount.

```tsx
import { ObserveInteractiveMarker } from 'expo-observe';

function Feed({ items }) {
  if (!items) return <Spinner />;

  return (
    <>
      <FeedList items={items} />
      <ObserveInteractiveMarker params={{ cacheHit: true }} />
    </>
  );
}
```

The marker fires **once**, on mount, so its `params` are read from the first render. Changing them later has no effect and logs a development warning. When the params are only known later, call `useObserve().markInteractive(...)` imperatively instead.

## Step 4 — Build the app

Metrics are collected from real builds, not from `expo start`:

```sh
npx --yes eas-cli@latest build
```

> By default, metrics collected from **debug builds** are not dispatched. A build is treated as a debug build when either the native app is a debug build or the JS bundle is a development bundle (`__DEV__` is `true`). To dispatch anyway while testing the integration, set `dispatchInDebug: true` when calling `configure()` — see [Enable metrics in development](https://docs.expo.dev/eas/observe/configuration/#enable-metrics-in-development). This has no effect on release builds.

## Step 5 — View the metrics

Open the **Observe** tab in the EAS dashboard at `https://expo.dev/accounts/[account]/projects/[project]/observe` to view metrics from the app.

To query metrics from the terminal with the EAS CLI, see [`./queries.md`](./queries.md). For interpreting the metrics themselves, see [`./metrics.md`](./metrics.md).

## Optional — per-route navigation metrics (SDK 56+)

By default `expo-observe` records app-wide startup metrics only. To additionally get **per-route / per-screen** navigation metrics (`cold_ttr`, `warm_ttr`, and a per-navigation `tti`, each tagged with the route/screen), enable one of the navigation integrations. These require **SDK 56 or later**; on earlier SDKs they are silent no-ops. Query the resulting data with `npx --yes eas-cli@latest observe:routes`, or with `observe:metrics` / `observe:metrics-summary` under the CLI aliases `nav_cold_ttr`, `nav_warm_ttr`, and `nav_tti` (see [`./queries.md`](./queries.md)).

Pick the integration that matches the app's router:

### Expo Router

Docs: https://docs.expo.dev/eas/observe/integrations/expo-router/

1. Enable the integration at module scope, **before any screen mounts** (it cannot be toggled at runtime — calling `configure()` after mount throws):

   ```tsx
   // app/_layout.tsx
   import { Observe } from 'expo-observe';

   Observe.configure({
     integrations: { 'expo-router': true },
   });
   ```

2. Call `useObserve()` inside each screen to get a `markInteractive` scoped to the current route, and call it from a `useEffect` once the screen is interactive:

   ```tsx
   import { useObserve } from 'expo-observe';
   import { useEffect } from 'react';

   export default function Home() {
     const { markInteractive } = useObserve();
     useEffect(() => {
       markInteractive();
     }, [markInteractive]);
     return (/* screen content */);
   }
   ```

Events are tagged with the route **pattern** (e.g. `/(tabs)/sessions/[sessionId]`) so the dashboard buckets distinct param values together; the resolved `url` and `routeParams` are also included. Requires `expo-router` installed at runtime, or the integration no-ops.

`router.prefetch()` does not count as a user navigation and never seeds a `cold_ttr` or `warm_ttr` measurement. The next user-driven navigation to a prefetched route emits `warm_ttr`, because the screen already rendered.

### React Navigation

Docs: https://docs.expo.dev/eas/observe/integrations/react-navigation/

Requires `@react-navigation/native` 7.0.0 or later. Same `useObserve()` screen usage as above, plus **two** extra changes:

1. Enable the integration at module scope, before mount:

   ```tsx
   // App.tsx
   import { Observe } from 'expo-observe';

   Observe.configure({
     integrations: { 'react-navigation': true },
   });
   ```

2. Connect the integration to the navigation tree. Which component you use depends on whether the app uses React Navigation's dynamic or static configuration. Both record the same per-screen metrics.

   **Dynamic configuration** — replace the top-level `<NavigationContainer>` with `<ObserveNavigationContainer>`. It is a drop-in replacement that accepts the same props and forwards the same ref. If you pass a `linking` config it is used to resolve a human-readable screen path; otherwise the metric falls back to `route.name`.

   ```tsx
   import { ObserveNavigationContainer } from 'expo-observe/integrations/react-navigation';

   export default function App() {
     return <ObserveNavigationContainer>{/* navigators */}</ObserveNavigationContainer>;
   }
   ```

   **Static configuration** — `createStaticNavigation()` renders the container for you, so there is nothing to replace. Create the navigation ref yourself, pass it to both `<Navigation>` and `<ObserveNavigationProvider>`, and the provider records the same timings by listening through that ref.

   ```tsx
   import { createStaticNavigation, useNavigationContainerRef } from '@react-navigation/native';
   import { ObserveNavigationProvider } from 'expo-observe/integrations/react-navigation';

   const Navigation = createStaticNavigation(RootStack);

   export default function App() {
     const navigationRef = useNavigationContainerRef();

     return (
       <ObserveNavigationProvider navigationRef={navigationRef}>
         <Navigation ref={navigationRef} />
       </ObserveNavigationProvider>
     );
   }
   ```

   `ObserveNavigationProvider` renders no container of its own, but it must be an ancestor of every screen so `useObserve()` works inside them. Pass the **same** ref to both elements; a ref that is not connected to a container emits no metrics.

With React Navigation v7's default `lazy: true`, unfocused tabs stay unmounted, so their first focus records as `cold_ttr` rather than `warm_ttr`.

In both integrations, `useObserve()` is safe to leave in place even when the integration is disabled or the router package is absent — it falls back to the global `markInteractive`.

### Per-route event params

Navigation events carry these params in addition to any custom ones passed to `markInteractive`:

| Param | Type | Notes |
|---|---|---|
| `routeName` | string | Route pattern (`/(tabs)/sessions/[sessionId]`) with Expo Router, route-name path (`/Tabs/Sessions`) with React Navigation. Never contains param values. |
| `url` | string | Resolved pathname. Expo Router only. |
| `routeParams` | object | Resolved route params, e.g. `{ sessionId: 'abc' }`. |
| `isAppLaunch` | boolean | `cold_ttr` only. `true` when measured from process start rather than from a navigation action. |
| `urlHidden` | boolean | Present as `true` when a filtered param caused `url` to be omitted. See below. |

### Filter sensitive params (SDK 57+)

By default the integrations export the resolved URL and every serializable route and query param. If any of those carry sensitive values, list their keys in `filteredParams`:

```tsx
Observe.configure({
  integrations: {
    'expo-router': { filteredParams: ['userId', 'token'] },
    // or: 'react-navigation': { filteredParams: ['userId', 'token'] },
  },
});
```

Filtered keys are removed from `routeParams`, and the event drops `url` in favor of `urlHidden: true`. `routeName` is unaffected, because it is a pattern and never contains param values.

### Common integration mistakes

- Calling `Observe.configure()` after mount, or toggling an integration flag mid-session, **throws**. Enable it at module scope.
- `Calling markInteractive on unmounted screen` or `No metadata available for the current screen` means the call ran outside a screen component or after unmount. Move it into a `useEffect` inside the screen component.
- Call `useObserve()` inside the screen component, not in a wrapper above it. A screen identity that changes between renders logs a warning.
- With React Navigation, `markInteractive()` records only once the screen is focused. A call on an unfocused screen updates internal state but emits no `tti` event until focus.

## Optional — user-defined events (SDK 56+)

Beyond the automatic startup and navigation metrics, you can record your own named events from anywhere in the app to track product moments — a completed onboarding, an exported report, a selected item. Use `Observe.logEvent(name, options?)`.

> Source: https://docs.expo.dev/eas/observe/events/ — consult this page for the latest guidance.

```tsx
import { Observe } from 'expo-observe';

function handleOnboardingComplete() {
  Observe.logEvent('onboarding.completed');
}
```

`logEvent` is a plain function call — it is **not** a hook and needs no `useObserve()`. Call it from event handlers, effects, or any non-render code. The event is persisted on-device and dispatched on the next flush (see dispatch notes below); the call returns immediately and never blocks the UI.

### Parameters

| Parameter | Type | Required | Notes |
|---|---|---|---|
| `name` | `string` | yes | Stable, dot-separated identifier, e.g. `'report.exported'`. |
| `options.attributes` | `Record<string, string \| number \| boolean \| array \| nested object>` | no | Structured context attached to the event. Other JS values (`Date`, `undefined`, functions) are dropped. |
| `options.body` | `string` | no | Free-form message complementing the structured attributes. |
| `options.severity` | `'trace' \| 'debug' \| 'info' \| 'warn' \| 'error' \| 'fatal'` | no | Defaults to `'info'`. |
| `options.displayName` | `string` | no | Human-friendly label, e.g. `'Onboarding completed'`. Used **only** in the dashboard's session timeline view; grouping still keys off `name`. |

**Attributes** are the primary way to make an event queryable — attach the identifiers and measurements you'll want to filter or break down by:

```tsx
Observe.logEvent('report.exported', {
  attributes: {
    format: 'csv',
    rowCount: 1248,
    durationMs: 532,
    filters: ['status:active', 'region:us-west'],
  },
});
```

**Severity and body** may be used for operational events you may want to triage by level:

```tsx
Observe.logEvent('cache.evicted', {
  body: 'Cache evicted because disk pressure exceeded the configured threshold.',
  severity: 'warn',
  attributes: { evictedItemCount: 42, freedBytes: 1048576 },
});
```

### Naming and privacy

- **Use lowercase, dot-separated names** (`task.completed`, `onboarding.skipped`). Keep them stable — `report_exported` and `report.exported` bucket as two separate events in the dashboard.
- **Never put PII in event names, attribute keys, or attribute values.** Everything is transmitted off-device and visible in the dashboard.

### Dispatch

User-defined events are persisted on-device, batched, and dispatched on the next flush as **OpenTelemetry log records** — the same delivery path and timing as other metrics. The debug-build caveat from [Step 4](#step-4--build-the-app) applies unchanged: debug builds don't dispatch unless `configure({ dispatchInDebug: true })` is set.

### Viewing events

User-defined events appear under the **Events** tab in the Observe dashboard, and are queryable from the terminal with `npx --yes eas-cli@latest observe:events` — see [`./queries.md`](./queries.md).

## Optional — error and crash reporting

`expo-observe` records JavaScript errors and native crashes alongside the performance metrics. Errors are persisted on-device, batched, and dispatched on the next flush. They appear on the **Observe > Errors** page of the dashboard. Docs: https://docs.expo.dev/eas/observe/errors/

> Error reporting is in **preview** and requires SDK 57+. Native crashes additionally require `expo-observe` 57.0.21+.

JavaScript errors arrive by three paths.

**1. Unhandled JS errors — automatic.** A global `ErrorUtils` handler is installed when the package is first imported, which is earlier than any `configure()` call, so errors thrown before configuration are still recorded. React Native's own behavior is unchanged: the red box in development and fatal termination in production still happen. Turn the recording off with `configure({ errorHandlingEnabled: false })`. This only affects unhandled JS errors — boundary errors, `reportError` calls, and native crashes are still recorded.

**2. Render-phase errors — `<ObserveErrorBoundary>`.** Without a boundary, a render error is recorded by the global handler as an unhandled error. A boundary records it with the React component stack and then renders `fallback` in place of the subtree.

```tsx
import { ObserveErrorBoundary } from 'expo-observe';

<ObserveErrorBoundary
  fallback={({ error, resetError }) => <ErrorScreen error={error} onRetry={resetError} />}>
  <Feed />
</ObserveErrorBoundary>;
```

`fallback` is required and accepts a React element, `null`, or a function receiving `{ error, resetError }`. `resetError()` clears the caught error and re-mounts the children, so they restart from a clean state. There is no capture-and-rethrow mode — a boundary always renders one of the three fallback forms. Errors that no boundary catches still reach the global handler.

For an app-wide boundary, pass `errorBoundaryFallback` to `ObserveRoot`. `ObserveRoot.wrap(Component)` takes no options, so replace `export default ObserveRoot.wrap(RootLayout)` with an outer wrapper that keeps `RootLayout` beneath `ObserveRoot`:

```tsx
export default function ObservedRootLayout() {
  return (
    <ObserveRoot errorBoundaryFallback={<FallbackScreen />}>
      <RootLayout />
    </ObserveRoot>
  );
}
```

Keep your existing `RootLayout` beneath `ObserveRoot` when making this change. Rendering `<ObserveRoot>` inside a layout is fine only when that layout just returns the wrapper and its children.

`ObserveRoot.wrap(RootLayout)` stays correct when no custom boundary is needed. Without `errorBoundaryFallback`, no root boundary is mounted and render errors are recorded by the global handler without the component stack. Pass `errorBoundaryFallback={null}` to capture render errors and render nothing after an error.

**3. Handled errors — `Observe.reportError(error)`.** Report failures your code caught and recovered from, which reach neither the global handler nor a boundary.

```tsx
try {
  await syncCart();
} catch (error) {
  Observe.reportError(error);
}
```

The value is normalized before it is sent: an `Error` contributes `name`, `message`, and `stack`; any other thrown value (a string, a plain object, a number) is stringified into the message with no stack. `reportError` never throws — it is called from a `catch` block, so a failure inside it must not turn a handled error into an unhandled one. Keep PII out of error messages; everything reported leaves the device and is visible in the dashboard.

### Native crashes — automatic

With `expo-observe` 57.0.21+, native crashes are recorded with no setup. The report is written on the device and dispatched on the **next launch**, so a recent crash can take time to appear. They show with the **Native** source in the dashboard.

- **Android:** uncaught Java/Kotlin exceptions, including the `Caused by` chain. On Android 11+, also the OS crash records for native-code crashes such as `SIGSEGV` and `SIGABRT`.
- **iOS:** MetricKit crash reports — Mach exceptions (`EXC_BAD_ACCESS`, `EXC_BREAKPOINT`) and Unix signals (`SIGSEGV`, `SIGBUS`, `SIGTRAP`). On iOS 17+, also uncaught Objective-C and Swift exceptions.
- **Not recorded:** tvOS, the iOS Simulator, ANRs, and out-of-memory terminations.

### Symbolicated stack traces

Production JS stack traces point into the minified bundle unless a source map is stored for the code that threw. Errors from the embedded bundle use the **build's** source map; errors from an OTA bundle use the **update's** source map. Upload both.

**Builds** — set `uploadSourceMaps` in the build profile:

```json
{ "build": { "production": { "uploadSourceMaps": true } } }
```

- Requires EAS CLI 22.0.0+ and a build on EAS Build servers. `eas build --local` does not upload source maps.
- `sourcesContent` is stripped before upload; only file names and mappings are stored. A failed upload only warns — the build still completes.

**EAS Updates** — publish with `--upload-source-maps` (EAS CLI 24.9.0+):

```bash
npx --yes eas-cli@latest update --channel production --upload-source-maps
```

- Uploads the map `expo export` emits for each native platform, with `sourcesContent` stripped.
- Maps over the 5 MiB upload limit are skipped with a warning; publishing never fails because of a source map.
- The error detail page links the update that supplied the map next to **Stack trace**, as it does for the build.

**Native frames.** On Android, Java and Kotlin frames already carry the class, method, and line. On iOS, frames in the app and its bundled frameworks show as a binary name and an offset (`MyApp + 19160`) until the app's dSYM files are uploaded:

- Requires `expo-observe` 57.0.25+ (SDK 57) or 58.0.5+ (SDK 58). Earlier crash reports have no binary UUIDs to match.
- On EAS Build, keep the dSYMs as a build artifact, then download `*.app.dSYM.zip` from the build page. If the download is a `.tar.gz` archive, extract it to get the `.app.dSYM.zip`. `eas build --local` writes the artifact next to the `.ipa`; when the pattern matches one file, the artifact is the `.app.dSYM.zip` renamed to `build-<timestamp>.zip`. Do not pass `--output`: the `.ipa` and the artifact then get the same path, and one replaces the other.

  ```json
  { "build": { "production": { "ios": { "buildArtifactPaths": ["ios/build/*.app.dSYM.zip"] } } } }
  ```

- For an app archived in Xcode and not built on EAS: in **Window** > **Organizer** > **Archives**, right-click the archive and select **Show in Finder**, then right-click the `.xcarchive` file, select **Show Package Contents**, and compress the `dSYMs` folder into a `.zip` file.
- Upload the `.zip` from a native crash in **Observe** > **Errors** (**Upload debug symbols**), or ahead of time in **Project settings** > **Observe debug symbols**. Upload the dSYMs of every build you release; an upload also applies to earlier crashes.
- A prebuilt framework such as Hermes has no dSYM in the archive. Add its dSYM from the publisher to the `.zip`.

**Not available yet:** Android ProGuard/R8 mapping upload, and ANR or out-of-memory capture. A separate crash reporter such as Sentry is still the option for those gaps.

## Optional — network traces (SDK 58+)

Network traces record completed network requests as spans: timed operations with a trace ID, a span ID, and an optional parent. Query them with `eas observe:traces` and `eas observe:trace` (see [`./queries.md`](./queries.md)). Each span counts toward the event quota.

Recording is off by default. Add `networkTraces` to the app's existing `Observe.configure()` call, not a second call: `configure()` replaces the full configuration, so a separate call resets the other options, and a later call without `networkTraces` turns recording off. Record every completed request, or only the hosts and methods that matter:

```ts
Observe.configure({ networkTraces: true });

// Or, to record only some hosts and methods:
Observe.configure({
  networkTraces: { filter: { hosts: ['api.myapp.com'], methods: ['GET', 'POST'] } },
});
```

- Hosts match exactly and case-insensitively; subdomains are not implied. An omitted field matches every request, and an empty array matches none. `{ enabled: false, filter }` keeps a filter while recording nothing.
- A request that is off or filtered out is never stored. The value persists across launches, so early-startup requests on the next launch follow the last value set, and removing the option takes effect only when `configure` runs again.
- URL credentials and common signature query parameters (`Signature`, `sig`, `X-Amz-Signature`, `X-Amz-Credential`, `X-Amz-Security-Token`, `X-Goog-Signature`, `AWSAccessKeyId`) are replaced with `REDACTED`. A secret in any other query parameter is stored as-is.

## Optional — runtime configuration

`Observe.configure()` controls collection and dispatch. Call it at module scope, before mount. The navigation integration flags (`expo-router`, `react-navigation`) cannot be toggled at runtime. The `react-native-reanimated` integration can be turned off by a later `configure()` call (see [`./library-integrations.md`](./library-integrations.md)).

| Option | Type | Default | What it does |
|---|---|---|---|
| `environment` | string | `process.env.NODE_ENV`, falling back to `'production'` | Metadata tag used to group metrics; filterable in the dashboard. Does not gate dispatch. |
| `dispatchingEnabled` | boolean | `true` | Master switch. While `false`, pending metrics are dropped, not queued. |
| `dispatchInDebug` | boolean | `false` | Dispatch metrics collected from debug builds. No effect on release builds. |
| `sampleRate` | number | `undefined` (all installations) | Fraction of installations that dispatch, in `[0, 1]`. |
| `errorSampleRate` | number | `undefined` (errors follow `sampleRate`) | Fraction of installations that dispatch errors and crashes, in `[0, 1]` (SDK 58+). A minimum: a value lower than `sampleRate` has no effect and `configure()` warns. |
| `errorHandlingEnabled` | boolean | `true` | Record unhandled JS errors as `exception` events. |
| `integrations` | object | `undefined` | Opt in to `expo-router`, `react-navigation`, `expo-image`, `react-native-reanimated`, or a third-party integration. For `expo-image` and `react-native-reanimated`, see [`./library-integrations.md`](./library-integrations.md). |
| `networkTraces` | boolean or object | `false` | Record network requests as trace spans (SDK 58+). See [Optional — network traces](#optional--network-traces-sdk-58). |

**Network request monitoring is automatic and has no off switch.** `expo-observe` observes `URLSession` traffic on iOS and `OkHttpClient` traffic on Android from launch, and attaches a rollup of the launch window to the TTI event — including the **host** of the slowest request (see [`./metrics.md`](./metrics.md)). Observe's own uploads are excluded. No `configure()` option disables it as of `expo-observe` 57.0.9, so treat request hosts as data that leaves the device. `networkTraces` controls the separate trace spans, not this rollup.

**Sampling** is deterministic per installation: an installation is permanently in-sample or out-of-sample for a given rate, so the slice is stable across launches rather than a random subset of sessions. Out-of-sample installations drop pending metrics instead of accumulating them, so lowering the rate later does not retroactively send earlier sessions. Values outside `[0, 1]` are clamped. Sampling depends on `dispatchingEnabled`. To keep more errors than metrics (SDK 58+), set `errorSampleRate` higher, such as `sampleRate: 0.03` with `errorSampleRate: 1`.

**Manual flush.** Events dispatch automatically when the app backgrounds — on Android through a background worker once connectivity returns, on iOS when the app resigns active or is about to terminate. Call `await Observe.dispatchEvents()` to flush early, which is mainly useful while testing.

**Custom endpoint.** EAS Observe sends OTLP over HTTP with a JSON payload, posting to `<endpointUrl>/<project-id>/v1/metrics` and `<endpointUrl>/<project-id>/v1/logs`. Point it at any OpenTelemetry-compatible backend or collector through the **app config**, not `configure()`:

```json
{ "expo": { "extra": { "eas": { "observe": { "endpointUrl": "https://your-endpoint.com" } } } } }
```

The URL is baked into the native layer at build time, so after changing it, run `npx --yes @expo/agent-cli@latest prebuild` and build the app again. If the backend expects standard OTLP paths without the project-ID prefix, route through a collector.

## Quick checklist

- [ ] SDK ≥ 55, EAS project linked, development or production build (not Expo Go).
- [ ] `expo-observe` installed via `npx --yes @expo/agent-cli@latest install`.
- [ ] Root component exported through `AppMetricsRoot.wrap(...)` (SDK 55) or `ObserveRoot.wrap(...)` (SDK 56+).
- [ ] `markInteractive()` called from every entry screen once it is genuinely interactive — global `AppMetrics.markInteractive()` on SDK 55, or `useObserve()` hook on SDK 56+.
- [ ] (Optional, SDK 56+) Per-route metrics enabled via `Observe.configure({ integrations: { ... } })`, plus `<ObserveNavigationContainer>` (dynamic) or `<ObserveNavigationProvider>` (static) for React Navigation.
- [ ] (Optional, SDK 57+) Sensitive route/query params listed in `filteredParams`.
- [ ] (Optional, SDK 56+) User-defined events emitted via `Observe.logEvent(name, { attributes })` with stable, lowercase, dot-separated names and no PII.
- [ ] (Optional) Library problem reports enabled via `integrations: { 'expo-image': true }` (SDK 57+) or `integrations: { 'react-native-reanimated': true }` (SDK 58+, Reanimated 4.7.0+), with no `configureReanimatedLogger` call in the app. See [`./library-integrations.md`](./library-integrations.md).
- [ ] (Optional, SDK 57+) `<ObserveErrorBoundary>` (or `errorBoundaryFallback` on `ObserveRoot`) around risky subtrees, `Observe.reportError` in recovery paths, `"uploadSourceMaps": true` in the `eas.json` build profile, and `npx --yes eas-cli@latest update --upload-source-maps` when publishing updates.
- [ ] (Optional, SDK 58+) `networkTraces` turned on, or filtered to the hosts and methods that matter.
- [ ] (Optional) iOS dSYMs uploaded for each release build, for symbolicated native crashes.
- [ ] New build produced with `npx --yes eas-cli@latest build` and metrics visible in the Observe dashboard.
third-party.md 4.5 KB
# Add an EAS Observe integration to a third-party package

This reference is for **package authors**, not app developers. It describes how a library ships an optional EAS Observe integration so that apps using the library get events about problems that application code cannot detect on its own.

> Source: https://docs.expo.dev/eas/observe/integrations/third-party/ — consult this page for the latest guidance.

App-side setup lives in [`./setup.md`](./setup.md). Querying the resulting events is in [`./queries.md`](./queries.md).

## When to use this

Report actionable issues the developer can fix. Good candidates:

- An image decoded at far higher resolution than the device screen needs.
- A background task that exceeds its expected duration.
- A native resource that loads slowly.

Do not use it for general product analytics or for anything the app author could log themselves.

## Requirements

- **Expo SDK 57 or later.** `Observe.registerIntegration()` is not available earlier.
- The consuming app must already have `expo-observe` installed and a build produced.

## Step 1 — Depend on `expo-observe` optionally

The package must keep working when `expo-observe` is absent. Declare it as an **optional peer dependency** plus a dev dependency for types and tests. Never make it a required runtime dependency.

```json
{
  "peerDependencies": { "expo-observe": ">=57.0.0" },
  "peerDependenciesMeta": { "expo-observe": { "optional": true } },
  "devDependencies": { "expo-observe": "^57.0.0" }
}
```

Load it with `require()` inside `try/catch`, and type it with `typeof import()` so the types survive:

```ts
// observe.ts
let observeModule: typeof import('expo-observe') | undefined;

try {
  observeModule = require('expo-observe') as typeof import('expo-observe');
} catch {
  // The integration stays disabled when expo-observe is not installed.
}
```

## Step 2 — Declare the integration config

Use declaration merging to add your integration key to `ObserveIntegrationsConfig`:

```ts
// observe.types.ts
export type YourPackageIntegrationConfig = {
  thresholdMs?: number;
};

declare module 'expo-observe' {
  interface ObserveIntegrationsConfig {
    'your-package'?: boolean | YourPackageIntegrationConfig;
  }
}
```

Export this declaration from the package entry point so TypeScript loads it when the app imports your package. App developers then enable it the same way they enable the first-party integrations:

```tsx
Observe.configure({
  integrations: {
    'your-package': true,
    // or, with options:
    // 'your-package': { thresholdMs: 1500 },
  },
});
```

## Step 3 — Register the integration

`Observe.registerIntegration(name, callback)` invokes the callback once, when the named integration config becomes available. The callback does not run when the key is omitted or set to `false`.

```ts
// observe.ts
export function initObserveIntegration() {
  // The `typeof window` check skips initialization during server-side rendering on web.
  if (typeof window !== 'undefined' && observeModule) {
    const { Observe } = observeModule;

    Observe.registerIntegration('your-package', config => {
      if (config) {
        enableObserveIntegration(config === true ? {} : config);
      }
    });
  }
}
```

Call the initializer from the package entry point:

```ts
// index.ts
import { initObserveIntegration } from './observe';

export type { YourPackageIntegrationConfig } from './observe.types';

initObserveIntegration();
```

Note the `config === true` normalization: the key accepts either a boolean or an options object, so collapse `true` to `{}` before using it.

## Step 4 — Log events

Emit through `Observe.logEvent()` when the package detects an actionable issue. Guard on both module presence and enablement, so a disabled integration costs nothing.

```ts
export function logExpensiveOperation(durationMs: number, thresholdMs: number) {
  if (!observeModule || !enabled) {
    return;
  }

  const { Observe } = observeModule;

  Observe.logEvent('your-package.expensive-operation', {
    severity: 'warn',
    body: 'Reduce the work performed by this operation or increase the configured threshold.',
    attributes: { durationMs, thresholdMs },
  });
}
```

Naming rules, matching the app-side event conventions in [`./setup.md`](./setup.md):

- Lowercase, dot-separated, with **your package name as the first segment**: `your-package.expensive-operation`.
- Keep names stable. The dashboard groups by exact name.
- No PII in names, attribute keys, or attribute values.
- Use `severity` to separate warnings from errors, and `body` for the remediation hint. The attributes carry the measurements.

License (MIT)

View full license text
The MIT License (MIT)

Copyright (c) 2025-present 650 Industries, Inc. (aka Expo)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.