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

[PLAT-11566] Instrument navigation spans #409

Closed gingerbenw closed 4 months ago

gingerbenw commented 4 months ago

Goal

Automatically instrument navigation spans when using react-native-navigation

Design

Add event listeners to the Navigation library to start and automatically end a navigation span when the route changes

Note: this approach also creates a navigation span for the initial route due to the way the end to end test is instrumented

Changeset

Testing

github-actions[bot] commented 4 months ago

Browser bundle size

NPM build

Package
Before 180.09 kB
After 180.09 kB
± No change

CDN build

Unminified Minfied Minified + gzipped
Before 87.01 kB 32.72 kB 10.01 kB
After 87.01 kB 32.72 kB 10.01 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/browser/lib/id-generator.ts 88.88%
(-11.12%)
0%
(-100%)
100%
(+0%)
88.88%
(-11.12%)
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/react-native-navigation/lib/react-native-navigation-plugin.ts 0%
(+0%)
0%
(-100%)
0%
(+0%)
0%
(+0%)

Total:

Lines Branches Functions Statements
89.1%(-2.03%) 80.31%(-0.6%) 89.38%(-2.61%) 86.38%(-2.12%)

Generated against 049db33be5211d9e03f5603e90c983fbbf576f79 on 23 February 2024 at 15:14:37 UTC

gingerbenw commented 4 months ago

@gareththackeray Should we know what the previous route was from a navigation?

gareththackeray commented 4 months ago

@gareththackeray Should we know what the previous route was from a navigation?

If we do know, I would suggest we include it as an attribute (bugsnag.navigation.previous_route). If it is not possible or very difficult I think we can live without it. We should also add it for React Navigation if we can.

gingerbenw commented 4 months ago

LGTM - possibly out of scope for this PR but do we need an additional test to check that the app start instrumentation works?

Raised ticket PLAT-11721 to instrument and test app start spans

gingerbenw commented 4 months ago

@gareththackeray Should we know what the previous route was from a navigation?

If we do know, I would suggest we include it as an attribute (bugsnag.navigation.previous_route). If it is not possible or very difficult I think we can live without it. We should also add it for React Navigation if we can.

Raised ticket PLAT-11722 to add previous route attributes