bugsnag / bugsnag-js-performance

Monitor the performance of your JavaScript (web and React Native) and see the results in your BugSnag dashboard.
https://docs.bugsnag.com/performance/integration-guides
MIT License
5 stars 3 forks source link

Add support for attaching to native performance SDKs #525

Closed yousif-bugsnag closed 3 weeks ago

yousif-bugsnag commented 3 weeks ago

Goal

Adds a new BugsnagPerformance.attach method to React Native Performance to allow attaching to an already running native (Android or Cocoa) performance SDK.

This is effectively a wrapper around BugsnagPerformance.start that loads the native configuration and uses this to start the native SDK

Design

Added a new method getNativeConfiguration to the Turbo Module, which returns the finalised configuration passed to native start or null if the native SDK has not been started.

When attach is called, the native config is merged with JS-specific config passed to attach before calling start

BugsnagPerformance.attach will log a warning and noop if the native SDK is not installed or has not been started.

Testing

github-actions[bot] commented 3 weeks ago

Browser bundle size

NPM build

Package
Before 210.63 kB
After 210.63 kB
± No change

CDN build

Unminified Minfied Minified + gzipped
Before 107.59 kB 40.60 kB 11.89 kB
After 107.59 kB 40.60 kB 11.89 kB
± No change No change No change

Code coverage

Ok File (✨=New File) Lines Branches Functions Statements
/home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/client.ts 100%
(+100%)
90%
(+90%)
100%
(+100%)
100%
(+100%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/native.ts 100%
(+100%)
50%
(+50%)
100%
(+100%)
100%
(+100%)
/home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/auto-instrumentation/index.ts 100%
(+100%)
100%
(+0%)
100%
(+0%)
100%
(+100%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/request-tracker/lib/index.ts 100%
(+0%)
85.71%
(+42.86%)
100%
(+25%)
100%
(+10%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/request-tracker/lib/request-tracker-xhr.ts 97.43%
(+2.56%)
72.72%
(+0%)
100%
(+0%)
96.61%
(+3.39%)

Total:

Lines Branches Functions Statements
90.31%(+2.38%) 80.68%(+1.92%) 87.87%(+1.17%) 89.04%(+3.02%)

Generated against 7739a9b77422d5344d38222580a9d21927efd753 on 7 November 2024 at 17:52:06 UTC

yousif-bugsnag commented 3 weeks ago

force-merging this as it's blocked by an unrelated Safari 11 browser test failure