Skip to content

Suppress LogBox during performance tracing - #55470

Closed
emily8rown wants to merge 1 commit into
react:mainfrom
emily8rown:export-D92527815
Closed

Suppress LogBox during performance tracing#55470
emily8rown wants to merge 1 commit into
react:mainfrom
emily8rown:export-D92527815

Conversation

@emily8rown

Copy link
Copy Markdown
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

meta-codesync Bot commented Feb 9, 2026

Copy link
Copy Markdown

@emily8rown has exported this pull request. If you are a Meta employee, you can view the originating Diff in 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
@meta-codesync

meta-codesync Bot commented Feb 13, 2026

Copy link
Copy Markdown

This pull request has been merged in a308014.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Feb 13, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @emily8rown in a308014

When will my fix make it into a release? | How to file a pick request?

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 Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants