Skip to content

Conversation

gingerbenw
Copy link
Member

@gingerbenw gingerbenw commented May 28, 2025

Goal

Support instrumentation of route change spans when using SvelteKit

Design

By using the available hooks from SvelteKit for beforeNavigate and afterNavigate we can directly read the /[route] instead of an absolute URL, meaning the resolveRoute method simply needs to convert it to a string. As users never interact with resolveRoute this implementation should work for this case.

Changeset

Added a new svelte-kit-performance library which exports a SvelteKitRoutingProvider

Testing

Added unit tests
Added end to end tests matching coverage with vue-router, etc

@gingerbenw gingerbenw changed the title Plat 14191/svelte kit navigation Add svelte kit routing provider May 28, 2025
Copy link

github-actions bot commented May 28, 2025

Browser bundle size

NPM build

Package
Before 217.95 kB
After 218.13 kB
± +182 bytes ⚠️

CDN build

Unminified Minfied Minified + gzipped
Before 110.02 kB 41.96 kB 12.27 kB
After 110.04 kB 41.99 kB 12.28 kB
± +22 bytes ⚠️ +27 bytes ⚠️ +10 bytes ⚠️

Code coverage

Ok File (✨=New File) Lines Branches Functions Statements
🔴 /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/browser/lib/index.ts 100%
(+0%)
100%
(+0%)
50%
(-16.66%)
100%
(+0%)
🔴 ✨ /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/svelte-kit/lib/index.ts 0%
(+0%)
100%
(+100%)
0%
(+0%)
0%
(+0%)
🔴 ✨ /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/svelte-kit/lib/svelte-kit-routing-provider.ts 75%
(+75%)
61.53%
(+61.53%)
66.66%
(+66.66%)
75%
(+75%)

Total:

Lines Branches Functions Statements
83.25%(-0.08%) 60.2%(+0.01%) 74.25%(-0.22%) 79.59%(-0.05%)

Generated against c0284d3 on 10 June 2025 at 16:40:15 UTC

@gingerbenw gingerbenw marked this pull request as ready for review May 29, 2025 10:58
Copilot

This comment was marked as outdated.

@gingerbenw gingerbenw force-pushed the PLAT-14191/svelte-kit-navigation branch from 731a1af to 829181d Compare May 29, 2025 14:37
@gingerbenw gingerbenw force-pushed the PLAT-14191/svelte-kit-navigation branch from 829181d to 6ea8820 Compare May 29, 2025 14:55
@gingerbenw gingerbenw force-pushed the PLAT-14191/svelte-kit-navigation branch from a345983 to ee74c31 Compare June 4, 2025 15:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new SvelteKit routing provider for Bugsnag performance to instrument route-change spans in SvelteKit apps, along with fixtures and tests.

  • Introduces @bugsnag/svelte-kit-performance package and SvelteKitRoutingProvider implementation
  • Adds unit tests for the routing provider and browser fixtures for end-to-end scenarios
  • Updates build configs, TypeScript settings, and project metadata (package.json, CHANGELOG)

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/browser/features/fixtures/packages/svelte-kit/src/routes/contact/+page.svelte Add contact page fixture
test/browser/features/fixtures/packages/svelte-kit/src/routes/+page.svelte Add home page fixture
test/browser/features/fixtures/packages/svelte-kit/src/routes/+layout.svelte Add layout that initializes BugsnagPerformance
test/browser/features/fixtures/packages/svelte-kit/src/routes/+layout.js Add prerender setting and load function
test/browser/features/fixtures/packages/svelte-kit/src/lib/index.js Placeholder lib folder
test/browser/features/fixtures/packages/svelte-kit/src/app.html SvelteKit app HTML template
test/browser/features/fixtures/packages/svelte-kit/src/200.html Static 200.html fallback page
test/browser/features/fixtures/packages/svelte-kit/package.json SvelteKit fixture package metadata
test/browser/features/fixtures/packages/svelte-kit/jsconfig.json JS config for SvelteKit
test/browser/features/fixtures/packages/svelte-kit/.npmrc Enforce engine-strict
test/browser/features/fixtures/packages/svelte-kit/.gitignore Git ignore for SvelteKit fixture
packages/svelte-kit/tsconfig.json TS config for the routing provider package
packages/svelte-kit/tests/svelte-kit-routing-provider.test.ts Unit tests for SvelteKitRoutingProvider
packages/svelte-kit/rollup.config.mjs Rollup build configuration
packages/svelte-kit/package.json @bugsnag/svelte-kit-performance package metadata
packages/svelte-kit/lib/svelte-kit-routing-provider.ts Implementation of the routing provider
packages/svelte-kit/lib/index.ts Exports the routing provider
packages/svelte-kit/README.md Documentation and usage example
packages/svelte-kit/.gitignore Git ignore for the routing provider package
CHANGELOG.md Changelog entry for the new routing provider

@gingerbenw gingerbenw requested a review from lemnik June 9, 2025 08:14
yousif-bugsnag
yousif-bugsnag previously approved these changes Jun 9, 2025
lemnik
lemnik previously approved these changes Jun 9, 2025
@gingerbenw gingerbenw dismissed stale reviews from lemnik and yousif-bugsnag via eea04f3 June 9, 2025 14:51
yousif-bugsnag
yousif-bugsnag previously approved these changes Jun 10, 2025
@gingerbenw
Copy link
Member Author

Sorry @yousif-bugsnag - last one, I promise!

@gingerbenw gingerbenw merged commit 952f053 into next Jun 11, 2025
22 checks passed
@gingerbenw gingerbenw deleted the PLAT-14191/svelte-kit-navigation branch June 11, 2025 08:02
@yousif-bugsnag yousif-bugsnag mentioned this pull request Jun 25, 2025
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.

3 participants