Expo Observe 简介

Expo Observe 是一项性能监控服务,可跟踪你的应用在真实设备和实际环境中的生产性能表现。


For the complete documentation index, see llms.txt. Use this file to discover all available pages.

重要 Expo Observe 处于私有预览阶段,可能会有重大更改。访问权限可通过请求获得(在此请求)。在预览期间可免费使用。

Expo Observe 是 Expo 提供的性能监控服务,用于跟踪你的应用在生产环境中的表现。它让你能够了解不同设备、网络和条件下的真实启动时间、渲染性能和用户体验。

在 React Native 中,调试性能传统上仅限于开发工具。Expo Observe 关注的是生产环境,其中的性能特性与开发过程中看到的有显著不同。

🌐 Debugging performance in React Native has traditionally been limited to development tools. Expo Observe focuses on production, where performance characteristics differ significantly from what you see during development.

快速开始

🌐 Quick start

Terminal
# Install the library
npx expo install expo-observe

AppMetricsRoot 组件封装你的根布局,并在应用准备好接受用户输入时调用 markInteractive()。完整的设置指南请参见 入门

🌐 Wrap your root layout with the AppMetricsRoot component and call markInteractive() when your app is ready for user input. See Get started for the full setup guide.

为什么观察 Expo

🌐 Why Expo Observe

传统的开发时性能分析工具显示你的应用在你的机器上的表现。Expo Observe 显示它对真实用户的表现:

🌐 Traditional development-time profiling tools show how your app performs on your machine. Expo Observe shows how it performs for real users:

  • 生产性能数据:跟踪来自各种设备的真实用户会话中的启动时间、渲染性能和包加载时间
  • 版本比较:查看应用版本和 OTA 更新之间指标的变化,以便及早发现回归问题
  • 会话调查:深入分析单个用户会话,以了解为什么某些设备或条件导致性能较慢
  • CLI 和仪表板访问:通过 eas observe: 命令在终端查询指标,或在 EAS 仪表板中查看它们

何时使用 Expo Observe

🌐 When to use Expo Observe

场景建议
在生产环境中监控应用启动性能
比较不同版本和 OTA 更新的性能
调查特定设备上的慢速会话
从 CLI 查询性能指标
开发时的性能分析和调试
崩溃报告和错误跟踪
自定义分析和事件追踪

开发时分析和调试:使用 React Native DevTools 进行调试,使用 Expo Atlas 进行包检查。

崩溃报告和错误跟踪:这是 Observe 未来计划添加的功能。与此同时,我们建议使用诸如 SentryBugSnag 的崩溃报告服务。

自定义分析和事件跟踪:这是未来计划为 Observe 添加的功能。在此期间,可以从 React Native 分析指南 中选择一个分析提供商,例如 PostHog、Amplitude 或 Firebase Analytics。

常见问题

🌐 Frequently asked questions (FAQ)

Expo Observe跟踪哪些指标?

Expo Observe 关注初创公司指标:冷启动时间、热启动时间、首次渲染时间、可交互时间和包加载时间。有关每个指标的详细描述,请参见 指标参考

🌐 Expo Observe focuses on startup metrics: cold launch time, warm launch time, time to first render, time to interactive, and bundle load time. See the Metrics reference for detailed descriptions of each metric.

支持哪些平台?

Expo Observe 支持 Android 和 iOS。指标从生产构建中收集,并且可以在仪表板和命令行接口中按平台过滤。

🌐 Expo Observe supports Android and iOS. Metrics are collected from production builds and can be filtered by platform in both the dashboard and CLI.

Expo Observe 是否收集个人身份信息?

不。用户通过每次应用安装唯一的匿名 ID 进行识别。该 ID 不属于个人可识别信息,如果用户卸载并重新安装应用,该 ID 会被重置。更多详情请参见 Metrics reference: User

🌐 No. Users are identified by an anonymous ID that is unique per app installation. This ID is not personally identifiable and is reset if the user uninstalls and reinstalls the app. See Metrics reference: User for more details.

当设备离线时会发生什么?

离线收集的指标会存储在设备本地。当应用进入后台且有可用连接时,它们会自动发送。你也可以使用 dispatchEvents() 手动刷新事件。

🌐 Metrics collected while offline are stored locally on the device. They are automatically dispatched when the app moves to the background and connectivity is available. You can also flush events manually using dispatchEvents().

我可以在开发过程中测试指标吗?

默认情况下,从调试版本收集的指标不会被发送。你可以通过 configure()dispatchInDebug 设置为 true 来进行测试时发送它们。详细信息请参见 配置

🌐 By default, metrics collected from debug builds are not dispatched. You can dispatch them anyway for testing by setting dispatchInDebug to true via configure(). See Configuration for details.

度量数据保留多久?

度量数据至少保留 60 天。

🌐 Metric data is retained for a minimum of 60 days.

开始使用

🌐 Get started

设置 Expo 观察

安装该库并开始从你的生产应用收集指标。

观察仪表板

查看指标,按平台或版本筛选,并调查单个会话。

配置

控制环境、调度和开发模式设置。

度量参考

每个指标、概念和数据处理的详细描述。