If you are using Angular routing, you can use the @bugsnag/angular-router-performance
package to automatically create route change and full page load spans with the appropriate route name.
The package can be installed from the npm registry using npm or yarn:
yarn add @bugsnag/angular-performance
# or
npm install --save @bugsnag/angular-performance
To use the package, create an AngularRoutingProvider
and provide it as part of your BugSnag configuration. In order for the provider to have access to the router, the bugsnagBootstrapper
is also required and should be registered as a provider:
import BugsnagPerformance from '@bugsnag/browser-performance';
import { AngularRoutingProvider, bugsnagBootstrapper } from '@bugsnag/angular-performance';
BugsnagPerformance.start({
apiKey: 'YOUR_API_KEY',
routingProvider: new AngularRoutingProvider(),
})
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
HttpClientModule,
AppRoutingModule
],
providers: [
bugsnagBootstrapper,
],
bootstrap: [AppComponent]
})
export class AppModule { }