Skip to content

Conversation

@emily8rown
Copy link
Contributor

Summary:
LogBox errors and warnings can affect performance trace measurements by triggering UI updates during profiling. This change adds a mechanism to suppress LogBox messages when performance tracing is active.

The implementation consists of:

  1. Native observer infrastructure (RuntimeTargetPerformanceTracerObserver.cpp/h): Installs a __PERFORMANCE_TRACER_OBSERVER__ object on the JavaScript global, which tracks tracing state and notifies subscribers when tracing starts/stops via onTracingStateChange.

  2. JavaScript observer (PerformanceTracerObserver.js): Provides a clean API to check tracing status (isTracing()) and subscribe to state changes. Gracefully handles environments where native support isn't available.

  3. LogBox integration (LogBoxData.js): Subscribes to the performance tracer observer and:

    • Clears all LogBox messages when tracing starts
    • Skips logging new errors and exceptions while tracing is active

This ensures trace measurements are not impacted by LogBox UI rendering during profiling sessions.

Changelog: [GENERAL] [ADDED] - Suppress LogBox warnings and errors during performance tracing

Differential Revision: D92527815

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 9, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 9, 2026

@emily8rown has exported this pull request. If you are a Meta employee, you can view the originating Diff in D92527815.

emily8rown added a commit to emily8rown/react-native that referenced this pull request Feb 9, 2026
Summary:

LogBox errors and warnings can affect performance trace measurements by triggering UI updates during profiling. This change adds a mechanism to suppress LogBox messages when performance tracing is active. It clears the logbox when tracing starts and drops messages during tracing

The implementation consists of:

1. **Native observer infrastructure** 
(`RuntimeTarget.cpp/h`, `RuntimeTargetPerformanceTracerObserver.cpp/h`): `RuntimeTarget` subscribes to the `PerformanceTracer` singleton's state changes and forwards them into JavaScript. It uses helper functions in                                     `RuntimeTargetPerformanceTracerObserver` to install a `__PERFORMANCE_TRACER_OBSERVER__` object on the JavaScript global (a global because it needs to exist before the module system initializes), which tracks tracing state and notifies subscribers via `onTracingStateChange`.

2. **JavaScript observer** (`PerformanceTracerObserver.js`): Provides a clean API to check tracing status (`isTracing()`) and subscribe to state changes. Gracefully handles environments where native support isn't available.

3. **LogBox integration** (`LogBoxData.js`): Subscribes to the performance tracer observer and:
   - Clears all LogBox messages when tracing starts
   - Skips logging new errors and exceptions while tracing is active

This ensures trace measurements are not impacted by LogBox UI rendering during profiling sessions.

Changelog: [GENERAL] [ADDED] - Suppress LogBox warnings and errors during performance tracing

Differential Revision: D92527815
emily8rown added a commit to emily8rown/react-native that referenced this pull request Feb 10, 2026
Summary:

LogBox errors and warnings can affect performance trace measurements by triggering UI updates during profiling. This change adds a mechanism to suppress LogBox messages when performance tracing is active. It clears the logbox when tracing starts and drops messages during tracing

The implementation consists of:

1. **Native observer infrastructure**
(`RuntimeTarget.cpp/h`, `RuntimeTargetPerformanceTracerObserver.cpp/h`): `RuntimeTarget` subscribes to the `PerformanceTracer` singleton's state changes and forwards them into JavaScript. It uses helper functions in                                     `RuntimeTargetPerformanceTracerObserver` to install a `__PERFORMANCE_TRACER_OBSERVER__` object on the JavaScript global (a global because it needs to exist before the module system initializes), which tracks tracing state and notifies subscribers via `onTracingStateChange`.

2. **JavaScript observer** (`PerformanceTracerObserver.js`): Provides a clean API to check tracing status (`isTracing()`) and subscribe to state changes. Gracefully handles environments where native support isn't available.

3. **LogBox integration** (`LogBoxData.js`): Subscribes to the performance tracer observer and:
   - Clears all LogBox messages when tracing starts
   - Skips logging new errors and exceptions while tracing is active

This ensures trace measurements are not impacted by LogBox UI rendering during profiling sessions.

Changelog: [GENERAL] [ADDED] - Suppress LogBox warnings and errors during performance tracing

Reviewed By: hoxyq

Differential Revision: D92527815
emily8rown added a commit to emily8rown/react-native that referenced this pull request Feb 11, 2026
Summary:

LogBox errors and warnings can affect performance trace measurements by triggering UI updates during profiling. This change adds a mechanism to suppress LogBox messages when CDP performance tracing is active. It clears the logbox when tracing starts and drops messages during tracing

The implementation consists of:

1. **Native observer infrastructure**
(`RuntimeTarget.cpp/h`, `RuntimeTargetPerformanceTracerObserver.cpp/h`): `RuntimeTarget` subscribes to the `PerformanceTracer` singleton's state changes and forwards them into JavaScript. It uses helper functions in                                     `RuntimeTargetPerformanceTracerObserver` to install a `__PERFORMANCE_TRACER_OBSERVER__` object on the JavaScript global (a global because it needs to exist before the module system initializes), which tracks tracing state and notifies subscribers via `onTracingStateChange`.

2. **JavaScript observer** (`PerformanceTracerObserver.js`): Provides a clean API to check tracing status (`isTracing()`) and subscribe to state changes. Gracefully handles environments where native support isn't available.

3. **LogBox integration** (`LogBoxData.js`): Subscribes to the performance tracer observer and:
   - Clears all LogBox messages when tracing starts
   - Skips logging new errors and exceptions while tracing is active

This ensures trace measurements are not impacted by LogBox UI rendering during profiling sessions.

Changelog: [GENERAL] [CHANGED] - Suppress LogBox warnings and errors during CDP performance tracing

Reviewed By: hoxyq

Differential Revision: D92527815
Summary:

LogBox errors and warnings can affect performance trace measurements by triggering UI updates during profiling. This change adds a mechanism to suppress LogBox messages when CDP performance tracing is active. It clears the logbox when tracing starts and drops messages during tracing

The implementation consists of:

1. **Native observer infrastructure**
(`RuntimeTarget.cpp/h`, `RuntimeTargetPerformanceTracerObserver.cpp/h`): `RuntimeTarget` subscribes to the `PerformanceTracer` singleton's state changes and forwards them into JavaScript. It uses helper functions in                                     `RuntimeTargetPerformanceTracerObserver` to install a `__PERFORMANCE_TRACER_OBSERVER__` object on the JavaScript global (a global because it needs to exist before the module system initializes), which tracks tracing state and notifies subscribers via `onTracingStateChange`.

2. **JavaScript observer** (`PerformanceTracerObserver.js`): Provides a clean API to check tracing status (`isTracing()`) and subscribe to state changes. Gracefully handles environments where native support isn't available.

3. **LogBox integration** (`LogBoxData.js`): Subscribes to the performance tracer observer and:
   - Clears all LogBox messages when tracing starts
   - Skips logging new errors and exceptions while tracing is active

This ensures trace measurements are not impacted by LogBox UI rendering during profiling sessions.

Changelog: [GENERAL] [CHANGED] - Suppress LogBox warnings and errors during CDP performance tracing

Reviewed By: hoxyq

Differential Revision: D92527815
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants