Created
April 19, 2021 06:47
-
-
Save StErMi/4f13afef8b24e6fded357412089f61b9 to your computer and use it in GitHub Desktop.
Sentry configuration for Angular app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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