enable apdex
This commit is contained in:
@ -1,19 +1,29 @@
|
||||
import * as Sentry from "@sentry/node";
|
||||
import getConfig from "next/config";
|
||||
import type { Integration } from "@sentry/types";
|
||||
import { RewriteFrames } from "@sentry/integrations";
|
||||
import { Integrations as TracingIntegrations } from "@sentry/tracing";
|
||||
|
||||
if (process.env.SENTRY_DSN) {
|
||||
const config = getConfig();
|
||||
const distDir = `${config.serverRuntimeConfig.rootDir}/.next`;
|
||||
const integrations: Integration[] = [
|
||||
new RewriteFrames({
|
||||
iteratee: (frame) => {
|
||||
frame.filename = frame.filename!.replace(distDir, "app:///_next");
|
||||
return frame;
|
||||
},
|
||||
}),
|
||||
];
|
||||
if (typeof window !== "undefined") {
|
||||
integrations.push(new TracingIntegrations.BrowserTracing());
|
||||
} else {
|
||||
integrations.push(new Sentry.Integrations.Http({ tracing: true }));
|
||||
}
|
||||
|
||||
Sentry.init({
|
||||
integrations: [
|
||||
new RewriteFrames({
|
||||
iteratee: (frame: any) => {
|
||||
frame.filename = frame.filename.replace(distDir, "app:///_next");
|
||||
return frame;
|
||||
},
|
||||
}),
|
||||
],
|
||||
integrations,
|
||||
tracesSampleRate: 0.5,
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
beforeSend(event, hint) {
|
||||
const error = hint?.originalException;
|
||||
|
Reference in New Issue
Block a user