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
4 stars 1 forks source link

Ignore requests to NetInfo reachability URL #377

Closed yousif-bugsnag closed 7 months ago

yousif-bugsnag commented 7 months ago

Goal

By default NetInfo makes HEAD requests to https://clients3.google.com/generate_204 to test if the internet is reachable. We don't want to create network spans for these, so this PR updates the network request plugin to ignore requests to this URL.

Testing

Added a new unit test and relied on existing e2e tests

github-actions[bot] commented 7 months ago

Browser bundle size

NPM build

Package
Before 174.33 kB
After 174.33 kB
± No change

CDN build

Unminified Minfied Minified + gzipped
Before 83.92 kB 31.67 kB 9.76 kB
After 83.92 kB 31.67 kB 9.76 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/id-generator.ts 90%
(-10%)
100%
(+0%)
100%
(+0%)
90%
(-10%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/react-native/lib/auto-instrumentation/network-request-plugin.ts 93.1%
(+0.25%)
75%
(+0%)
100%
(+0%)
91.42%
(+0.52%)

Total:

Lines Branches Functions Statements
87.2%(-0.06%) 69.78%(+0%) 86.3%(+0.04%) 84.74%(-0.04%)

Generated against e7545cff515080534fcec98d8e8b4d8352f06a05 on 4 December 2023 at 12:33:05 UTC

yousif-bugsnag commented 7 months ago

ah, turns out that the NetInfo request is made with the no-cache option, which means a cache busting query param is added by RN fetch. Updated the code and test accordingly.