Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegate first class spans to native SDK when attached #556

Conversation

yousif-bugsnag
Copy link
Contributor

@yousif-bugsnag yousif-bugsnag commented Dec 31, 2024

Goal

Delegates the creation and processing of first class spans in React Native to the native Android/Cocoa Performance SDK when attached.

Design

If a native SDK is running and attached (by calling BugsnagPerformance.attach), first-class spans are started, processed and discarded in the native SDK.

JS spans that are backed by a native span are wrapped in a NativeSpanInternal class to distinguish them from regular JS spans.

Refactored the core start logic so that the span factory is configured synchronously as soon as start is called - this is so that onSpanEnd callbacks can be applied to spans started immediately after attach is called. Note that any first class spans started before attach is called will not be delegated and will be started/processed in JS.

Testing

  • Added unit tests for ReactNativeSpanFactory class
  • Updated native integration e2e test scenario to verify that native spans are processed correctly

Copy link

github-actions bot commented Dec 31, 2024

Browser bundle size

NPM build

Package
Before 211.89 kB
After 212.81 kB
± +918 bytes ⚠️

CDN build

Unminified Minfied Minified + gzipped
Before 107.84 kB 40.67 kB 11.93 kB
After 108.02 kB 40.89 kB 11.99 kB
± +180 bytes ⚠️ +217 bytes ⚠️ +68 bytes ⚠️

Code coverage

Ok File (✨=New File) Lines Branches Functions Statements
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/core/lib/attributes.ts 98.5%
(-1.5%)
100%
(+0%)
94.11%
(-5.89%)
98.55%
(-1.45%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/core/lib/batch-processor.ts 96.66%
(-0.77%)
94.11%
(-1.34%)
100%
(+0%)
96.72%
(-0.74%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/core/lib/core.ts 100%
(+0%)
94.44%
(+0%)
92.85%
(+0%)
98.43%
(-0.05%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/core/lib/span.ts 93.44%
(+2.97%)
90%
(+6.67%)
78.26%
(+0.99%)
93.54%
(+3.07%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/client.ts 100%
(+0%)
66.66%
(-16.67%)
100%
(+0%)
100%
(+0%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/span-factory.ts 100%
(+33.34%)
86.95%
(-13.05%)
100%
(+50%)
100%
(+16.67%)
/home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/persistence/index.ts 100%
(+7.15%)
100%
(+60%)
100%
(+0%)
100%
(+6.67%)

Total:

Lines Branches Functions Statements
90.29%(+0.21%) 80.33%(+0.41%) 88.05%(+0.31%) 89.07%(+0.22%)

Generated against c925489 on 6 January 2025 at 12:09:00 UTC

@yousif-bugsnag yousif-bugsnag force-pushed the PLAT-12944/native-first-class-spans branch 5 times, most recently from d165e50 to 3ad1c0f Compare January 2, 2025 12:36
@yousif-bugsnag yousif-bugsnag force-pushed the PLAT-12944/native-first-class-spans branch from 3ad1c0f to 97aeffe Compare January 2, 2025 12:43
@yousif-bugsnag yousif-bugsnag requested a review from lemnik January 6, 2025 09:55
@yousif-bugsnag yousif-bugsnag merged commit 7d25f48 into integration/rn-native-integration Jan 7, 2025
43 checks passed
@yousif-bugsnag yousif-bugsnag deleted the PLAT-12944/native-first-class-spans branch January 7, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants