Skip to content

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

perf: increase sample rate for POST and trpc (#1284)

Max Deichmann338517828c74
diff --git a/web/sentry.server.config.ts b/web/sentry.server.config.ts
index e4b2a21b83..33c7f69149 100644
--- a/web/sentry.server.config.ts
+++ b/web/sentry.server.config.ts
@@ -2,7 +2,7 @@ import { prisma } from "@/src/server/db";
import { jsonSchema } from "@/src/utils/zod";
import * as Sentry from "@sentry/nextjs";
import { ProfilingIntegration } from "@sentry/profiling-node";
-import type { TransactionEvent } from "@sentry/types";
+import type { SamplingContext, TransactionEvent } from "@sentry/types";
if (process.env.NEXT_PUBLIC_SENTRY_DSN)
Sentry.init({
@@ -12,7 +12,18 @@ if (process.env.NEXT_PUBLIC_SENTRY_DSN)
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
- tracesSampleRate: 0.3,
+ tracesSampleRate: 1.0,
+ tracesSampler: (samplingContext: SamplingContext) => {
+ if (
+ samplingContext.request &&
+ samplingContext.request.method === "POST" &&
+ samplingContext.request.url &&
+ samplingContext.request.url.includes("api/trpc")
+ ) {
+ return 1.0;
+ }
+ return 0.3;
+ },
profilesSampleRate: 0.3, // Profiling sample rate is relative to tracesSampleRate
integrations: [