Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: improve client side sentry (#3312)

Max Deichmannc86e32f75608
diff --git a/web/Dockerfile b/web/Dockerfile
index f8cfe084a5..c99d0ac07c 100644
--- a/web/Dockerfile
+++ b/web/Dockerfile
@@ -41,8 +41,9 @@ ARG NEXT_PUBLIC_TURNSTILE_SITE_KEY
ARG NEXT_PUBLIC_POSTHOG_KEY
ARG NEXT_PUBLIC_POSTHOG_HOST
ARG NEXT_PUBLIC_CRISP_WEBSITE_ID
-ARG NEXT_PUBLIC_SENTRY_DSN
ARG NEXT_LANGFUSE_TRACING_SAMPLE_RATE
+ARG NEXT_PUBLIC_SENTRY_ENVIRONMENT
+ARG NEXT_PUBLIC_SENTRY_DSN
# Accept build id as NEXT_PUBLIC_BUILD_ID or PORTER_NEXT_PUBLIC_BUILD_ID
ARG PORTER_NEXT_PUBLIC_BUILD_ID
diff --git a/web/sentry.client.config.ts b/web/sentry.client.config.ts
index d0f35c1e28..46ab6d3665 100644
--- a/web/sentry.client.config.ts
+++ b/web/sentry.client.config.ts
@@ -2,14 +2,15 @@ import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
+ environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT,
// Replay may only be enabled for the client-side
integrations: [
Sentry.replayIntegration(),
// Sentry.debugIntegration(),
- Sentry.captureConsoleIntegration({
- levels: ["error"],
- }),
+ // Sentry.captureConsoleIntegration({
+ // levels: ["error"],
+ // }),
],
// Set tracesSampleRate to 1.0 to capture 100%
@@ -27,14 +28,6 @@ Sentry.init({
replaysOnErrorSampleRate: 1.0,
debug: false,
- beforeSend(event, _hint) {
- // Check if it is an exception, and if so, show the report dialog
- if (event.exception) {
- Sentry.showReportDialog({ eventId: event.event_id });
- }
- return event;
- },
-
// ...
// Note: if you want to override the automatic release value, do not set a
diff --git a/web/src/utils/api.ts b/web/src/utils/api.ts
index 3c88e0bc1c..f7dfd3d5d8 100644
--- a/web/src/utils/api.ts
+++ b/web/src/utils/api.ts
@@ -22,6 +22,7 @@ import { type AppRouter } from "@/src/server/api/root";
import { setUpSuperjson } from "@/src/utils/superjson";
import { trpcErrorToast } from "@/src/utils/trpcErrorToast";
import { showVersionUpdateToast } from "@/src/features/notifications/showVersionUpdateToast";
+import { captureException } from "@sentry/nextjs";
setUpSuperjson();
@@ -37,6 +38,7 @@ let buildId: string | null = null;
const CLIENT_STALE_CACHE_CODES = [404, 400];
const handleTrpcError = (error: unknown) => {
+ captureException(error);
if (error instanceof TRPCClientError) {
const httpStatus: number =
typeof error.data?.httpStatus === "number" ? error.data.httpStatus : 500;