Skip to content

Instantly share code, notes, and snippets.

@StErMi
Created April 19, 2021 06:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StErMi/4f13afef8b24e6fded357412089f61b9 to your computer and use it in GitHub Desktop.
Save StErMi/4f13afef8b24e6fded357412089f61b9 to your computer and use it in GitHub Desktop.
Sentry configuration for Angular app
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import * as Sentry from '@sentry/angular';
import { Integrations } from '@sentry/tracing';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
Sentry.init({
environment: environment.environment,
release: `${environment.package_name}@${environment.package_version}`,
dsn: environment.sentry_dsn,
integrations: [
// Registers and configures the Tracing integration,
// which automatically instruments your application to monitor its
// performance, including custom Angular routing instrumentation
new Integrations.BrowserTracing({
tracingOrigins: [environment.api_url, /^\//],
routingInstrumentation: Sentry.routingInstrumentation,
}),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: environment.environment === 'production' ? 0.2 : 1,
});
enableProdMode();
platformBrowserDynamic()
.bootstrapModule(AppModule)
.then((success) => console.log(`Bootstrap success`))
.catch((err) => console.error(err));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment