import { enableProdMode } from "@angular/core"; import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; import * as Sentry from "@sentry/angular-ivy";
import { AppModule } from "./app/app.module";
Sentry.init({ dsn: "your_dsn_get_from_sentry_project_configuration", integrations: [ new Sentry.BrowserTracing({ // Set 'tracePropagationTargets' to control forwhich URLs distributed tracing should be enabled tracePropagationTargets: [], routingInstrumentation: Sentry.routingInstrumentation, }), new Sentry.Replay(), ], // Performance Monitoring tracesSampleRate: 1.0, // Capture 100% of the transactions // Session Replay replaysSessionSampleRate: 0.01, // This sets the sample rate at 10%. You may want to change it to 100% whilein development and then sample at a lower rate in production. replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur. }); enableProdMode(); platformBrowserDynamic() .bootstrapModule(AppModule) .then((success) => console.log('Bootstrap success')) .catch((err) => console.error(err));
issue 2: 开启SSR(服务器端渲染)后在日志中看到很多这样的错误”ErrorEvent is not defined”。
1 2 3 4 5 6 7 8 9 10 11 12 13
ReferenceError: ErrorEvent is not defined at extractHttpModuleError (node_modules/@sentry/angular-ivy/fesm2015/sentry-angular-ivy.js:101:32) at SentryErrorHandler._defaultExtractor (node_modules/@sentry/angular-ivy/fesm2015/sentry-angular-ivy.js:187:20) at SentryErrorHandler._extractError (node_modules/@sentry/angular-ivy/fesm2015/sentry-angular-ivy.js:178:21) at SentryErrorHandler.handleError (node_modules/@sentry/angular-ivy/fesm2015/sentry-angular-ivy.js:135:37) at Object.apply [as next] (node_modules/@angular/core/fesm2022/core.mjs:28159:42) at Object.next (node_modules/rxjs/dist/cjs/internal/Subscriber.js:161:21) at SafeSubscriber._next (node_modules/rxjs/dist/cjs/internal/Subscriber.js:101:26) at SafeSubscriber.next (node_modules/rxjs/dist/cjs/internal/Subscriber.js:72:18) at cb (node_modules/rxjs/dist/cjs/internal/Subject.js:66:34) at Object.errorContext (node_modules/rxjs/dist/cjs/internal/util/errorContext.js:22:9)