tencent cloud

문서Tencent Cloud Observability Platform

Installation and Initialization

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-10-20 11:59:58
AI 번역
RN applications can only be installed via NPM, and the native modules built into the SDK must be built together with the app's native project.

Prerequisites

Version Requirements: React Native must be version 0.60 or later, and iOS must be version 11 or later.
Optional Dependency: @react-native-async-storage/async-storage (>= 1.0.0), which is used to persist aid (a unique device identifier used to distinguish devices and calculate uv). If it is not installed, the SDK automatically falls back to an aid that is not persisted within the session.

Step 1: Installing the SDK

1. Run the following command to install aegis-rn-sdk from the npm registry. The dependency will be written to package.json in the project root directory:
npm install --save aegis-rn-sdk
2. The SDK includes native modules (such as cold/warm start time collection, first-frame onDraw collection, and frame rate statistics) and must be built together with the app's native project:
Android: Automatic linking is enabled (react-native.config.js has been configured with AegisPerfPackage). The dependency is located in the android/ native project, so you do not need to manually add it to android/app/build.gradle.
iOS: The dependency is located in the ios/ directory. After pod install is executed, it is automatically integrated through aegis-rn-sdk.podspec, so you do not need to manually add it to Podfile.
If automatic linking fails, see the React Native official documentation (Android Native Modules, iOS Native Modules) to manually complete native module registration.

Step 2: Initializing the SDK

Follow the steps below to create an Aegis instance, pass in the corresponding configuration, and initialize the SDK:
import Aegis from 'aegis-rn-sdk';

const aegis = new Aegis({
id: 'pGUVFTCZyewhxxxxxx', // Application ID, which is the reporting ID
uin: 'xxx', // Unique user ID (optional)
reportApiSpeed: true, // API speed test
hostUrl: 'https://rumt-zh.com', // Reporting domain, rumt-zh.com for the Chinese mainland
})
Note:
To avoid missing data, initialize the SDK as early as possible. We recommend placing the initialization in the application entry file (such as index.js / App.tsx) and completing it before the route container and first-screen UI are rendered. Cold start monitoring relies on the processStartTime recorded by the native side, so the earlier the initialization, the more complete the startup time data.
After you have installed and initialized the SDK, you can start using the following features provided by RUM:
Error Monitoring: JS execution errors, Promise errors, API request exceptions, return code exceptions, allowlist detection, and more.
Speed Test Features: cold/hot startup monitoring, page speed tests (TTID/TTFD), route switching duration, and API speed tests.
Page Navigation Monitoring (PV): Page PVs are automatically reported after spa is enabled and routes are connected.
Data Statistics and Analysis: You can analyze data from various dimensions on the RUM data overview page.
By default, aegis-rn-sdk uses https://rumt-zh.com as the reporting domain. You can control the reporting domain through the hostUrl parameter.
For the Chinese mainland, you can use https://rumt-zh.com as the reporting domain.
For the Singapore region, you can use https://rumt-sg.com as the reporting domain.
For the Silicon Valley region, you can use https://rumt-us.com as the reporting domain.


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백