Skip to content

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

chore(sentry): restrict loggerLink to development environment only for less noise in sentry (#7684)

marliessophieebd4cf3e8ab0
diff --git a/web/src/utils/api.ts b/web/src/utils/api.ts
index fbe1d78adb..dc1bf14563 100644
--- a/web/src/utils/api.ts
+++ b/web/src/utils/api.ts
@@ -129,9 +129,10 @@ export const api = createTRPCNext<AppRouter>({
links: [
buildIdLink(),
loggerLink({
- enabled: (opts) =>
- process.env.NODE_ENV === "development" ||
- (opts.direction === "down" && opts.result instanceof Error),
+ // Only enable in development - production logs would be captured by Sentry
+ // in an unreadable format. We handle 5xx errors via captureException() in
+ // handleTrpcError and use DataDog for additional server-side logging.
+ enabled: () => process.env.NODE_ENV === "development",
}),
splitLink({
condition(op) {
@@ -186,9 +187,10 @@ export const directApi = createTRPCProxyClient<AppRouter>({
transformer: superjson,
links: [
loggerLink({
- enabled: (opts) =>
- process.env.NODE_ENV === "development" ||
- (opts.direction === "down" && opts.result instanceof Error),
+ // Only enable in development - production logs would be captured by Sentry
+ // in an unreadable format. We handle 5xx errors via captureException() in
+ // handleTrpcError and use DataDog for additional server-side logging.
+ enabled: () => process.env.NODE_ENV === "development",
}),
httpBatchLink({
url: `${getBaseUrl()}/api/trpc`,