If you use SvelteKit in your app, you can record the timings of app navigation events shown on the BugSnag Performance dashboard.
The package can be installed from the npm registry using npm or yarn:
yarn add @bugsnag/svelte-kit-performance
# or
npm install --save @bugsnag/svelte-kit-performance
To use the plugin, create a new routing provider when you start the BugSnag Performance client, passing it the beforeNavigate
, afterNavigate
and initialRoute
parameters from SvelteKit:
<script>
import BugsnagPerformance from '@bugsnag/browser-performance'
import { SvelteKitRoutingProvider } from '@bugsnag/svelte-kit-performance'
import { beforeNavigate, afterNavigate } from '$app/navigation'
import { page } from '$app/state'
BugsnagPerformance.start({
apiKey: 'YOUR_API_KEY',
routingProvider: new SvelteKitRoutingProvider(beforeNavigate,
afterNavigate,
page.route.id)
})
</script>