feat: replace sentry with posthog

This commit is contained in:
2026-04-11 15:38:10 +07:00 Unverified
parent 46d4bf0119
commit 6247f98b6a
29 changed files with 1644 additions and 702 deletions
+7 -37
View File
@@ -1,39 +1,9 @@
// This file configures the initialization of Sentry on the client.
// The added config here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import posthog from "posthog-js";
import { env } from "node:process";
import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: "https://9a918fb166b0abde6cbb698191ac61c9@o4510549315420160.ingest.us.sentry.io/4510549315616768",
enabled: env.ENVIRONMENT === "production",
// Add optional integrations for additional features
integrations: [
Sentry.replayIntegration({
maskAllText: false,
blockAllMedia: false,
}),
],
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
tracesSampleRate: 1,
// Enable logs to be sent to Sentry
enableLogs: true,
// Define how likely Replay events are sampled.
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// Define how likely Replay events are sampled when an error occurs.
replaysOnErrorSampleRate: 1.0,
// Enable sending user PII (Personally Identifiable Information)
// https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/options/#sendDefaultPii
sendDefaultPii: true,
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN!, {
api_host: "/i",
ui_host: "https://us.posthog.com",
defaults: "2026-01-30",
capture_exceptions: true,
debug: process.env.ENVIRONMENT === "development",
});
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;