Performance Telemetry
Capture native and React Native memory, FPS, battery, and custom point-in-time metrics from React Native app code.
React Native telemetry combines native platform channels with bridge-owned React Native memory channels.
Built-In Channels
Supported channels include:
- native memory channels from iOS or Android
- React Native JS heap used
- React Native JS heap total
- native FPS
- native battery level when enabled
- app-defined metric channels
React Native Memory
await Ansight.initializeAndActivate({
reactNativeMemory: {
enabled: true,
jsHeapUsed: true,
jsHeapTotal: true,
},
});
The native bridge samples JS heap values when the native sampler is available. Set reactNativeMemory: false to disable these channels.
Custom Metrics
await Ansight.registerMetricChannel({
id: 42,
name: "Queue Depth",
colorHex: "#FF9500",
unit: "items",
type: "queue",
});
await Ansight.metric(17, 42);
Read retained samples:
const metrics = await Ansight.recordedMetrics(100);
const events = await Ansight.recordedEvents(100);
Runtime Toggles
const fpsEnabled = await Ansight.isFramesPerSecondEnabled();
await Ansight.enableFramesPerSecond();
await Ansight.disableFramesPerSecond();
await Ansight.captureBuiltInTelemetrySample();