chore: Update sentry config

This commit is contained in:
Joakim Jäderberg
2024-12-20 11:04:46 +01:00
parent f7ec34d86f
commit 1f61bdc060
6 changed files with 12 additions and 2 deletions

2
env/client.ts vendored
View File

@@ -6,7 +6,7 @@ export const env = createEnv({
NEXT_PUBLIC_NODE_ENV: z.enum(["development", "test", "production"]),
NEXT_PUBLIC_PORT: z.string().default("3000"),
NEXT_PUBLIC_SENTRY_ENVIRONMENT: z.string().default("development"),
NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE: z.coerce.number().default(0.01),
NEXT_PUBLIC_SENTRY_CLIENT_SAMPLERATE: z.coerce.number().default(0.001),
NEXT_PUBLIC_HIDE_FOR_NEXT_RELEASE: z
.string()
// only allow "true" or "false"

2
env/server.ts vendored
View File

@@ -130,7 +130,7 @@ export const env = createEnv({
.transform((s) => s === "true")
.default("false"),
SENTRY_ENVIRONMENT: z.string().default("development"),
SENTRY_SERVER_SAMPLERATE: z.coerce.number().default(0.01),
SENTRY_SERVER_SAMPLERATE: z.coerce.number().default(0.001),
},
emptyStringAsUndefined: true,
runtimeEnv: {

View File

@@ -1,6 +1,7 @@
import * as Sentry from "@sentry/nextjs"
import { env } from "./env/client"
import { denyUrls } from "./sentry.shared.config"
Sentry.init({
dsn: "https://fe39c070b4154e2f9cc35f0e5de0aedb@o4508102497206272.ingest.de.sentry.io/4508102500286544",
@@ -14,4 +15,5 @@ Sentry.init({
// For example, a tracesSampleRate of 0.5 and profilesSampleRate of 0.5 would
// result in 25% of transactions being profiled (0.5*0.5=0.25)
profilesSampleRate: 0.01,
denyUrls: [...denyUrls],
})

View File

@@ -1,6 +1,7 @@
import * as Sentry from "@sentry/nextjs"
import { env } from "./env/server"
import { denyUrls } from "./sentry.shared.config"
Sentry.init({
dsn: "https://fe39c070b4154e2f9cc35f0e5de0aedb@o4508102497206272.ingest.de.sentry.io/4508102500286544",
@@ -8,4 +9,5 @@ Sentry.init({
enabled: env.SENTRY_ENVIRONMENT !== "development",
tracesSampleRate: env.SENTRY_SERVER_SAMPLERATE,
denyUrls: [...denyUrls],
})

View File

@@ -1,10 +1,12 @@
import * as Sentry from "@sentry/nextjs"
import { env } from "./env/server"
import { denyUrls } from "./sentry.shared.config"
Sentry.init({
dsn: "https://fe39c070b4154e2f9cc35f0e5de0aedb@o4508102497206272.ingest.de.sentry.io/4508102500286544",
environment: env.SENTRY_ENVIRONMENT,
enabled: env.SENTRY_ENVIRONMENT !== "development",
tracesSampleRate: env.SENTRY_SERVER_SAMPLERATE,
denyUrls: [...denyUrls],
})

4
sentry.shared.config.ts Normal file
View File

@@ -0,0 +1,4 @@
export const denyUrls: (string | RegExp)[] = [
// Ignore preview urls
/\/.{2}\/preview\//,
]