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

[PLAT-11800] Delay initial span batching #433

Closed gingerbenw closed 6 months ago

gingerbenw commented 6 months ago

Goal

This PR ensures that the correct sampling rate is used for a batch which is filled before the initial sampling request has been made by delaying batching while the request is in flight.

The config option for samplingProbability has also been removed.

Testing

Add integration test for browser client which awaits the initial sampling request when a full batch is created before starting bugsnag

github-actions[bot] commented 6 months ago

Browser bundle size

NPM build

Package
Before 183.47 kB
After 183.98 kB
± +515 bytes ⚠️

CDN build

Unminified Minfied Minified + gzipped
Before 91.28 kB 34.22 kB 10.37 kB
After 91.76 kB 34.46 kB 10.41 kB
± +483 bytes ⚠️ +236 bytes ⚠️ +33 bytes ⚠️

Code coverage

Ok File (✨=New File) Lines Branches Functions Statements
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/core/lib/batch-processor.ts 94.64%
(+0.2%)
88.23%
(+0.73%)
100%
(+0%)
94.64%
(+0.2%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/core/lib/config.ts 77.41%
(+2.41%)
80.95%
(+10.12%)
42.85%
(+5.35%)
78.12%
(+2.37%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/browser/lib/browser.ts 90.62%
(+3.12%)
75%
(+0%)
100%
(+50%)
90.62%
(+3.12%)
/home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/browser/lib/clock.ts 100%
(+6.25%)
100%
(+0%)
100%
(+14.29%)
100%
(+6.25%)
/home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/browser/lib/id-generator.ts 100%
(+11.12%)
100%
(+100%)
100%
(+0%)
100%
(+11.12%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/browser/lib/auto-instrumentation/resource-load-plugin.ts 72%
(+0%)
56%
(+4%)
100%
(+0%)
73.07%
(+1.92%)

Total:

Lines Branches Functions Statements
87.97%(+0.3%) 79.45%(+0.8%) 89.24%(+0.69%) 84.78%(+0.34%)

Generated against 74e9c66e28367397727a1db966f33b7ac17ae842 on 5 April 2024 at 10:19:39 UTC