Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to reduce sentry usage #831

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions packages/ui/docs-bundle/sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@

import * as Sentry from "@sentry/nextjs";

const sentryEnv = process?.env.NEXT_PUBLIC_APPLICATION_ENVIRONMENT ?? "dev";

Sentry.init({
dsn: "https://216ad381a8f652e036b1833af58627e5@o4507138224160768.ingest.us.sentry.io/4507148139495424",
// Do not enable sentry locally
enabled: process.env.NODE_ENV === "production",
environment: process?.env.NEXT_PUBLIC_APPLICATION_ENVIRONMENT ?? "dev",

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Performance Monitoring
tracesSampleRate: sentryEnv === "dev" ? 0.5 : 0.75, // Capture 75% of the transactions
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: sentryEnv === "dev" ? 0.5 : 0.75,

sampleRate: 1.0,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

// Capture all error replays, but only half all others
replaysOnErrorSampleRate: 1.0,
// 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: 1.0,
replaysSessionSampleRate: sentryEnv === "dev" ? 0 : 0.5,

autoSessionTracking: true,

Expand All @@ -35,4 +37,21 @@ Sentry.init({
],
// This option is required for capturing headers and cookies.
sendDefaultPii: true,

beforeSend: (event: Sentry.Event, _: Sentry.EventHint): Sentry.Event | null => {
// Filter out events from privategpt
if (event.request?.url?.includes("privategpt")) {
return null;
}
if (
event.tags != null &&
event.tags["url"] != null &&
typeof event.tags["url"] === "string" &&
event.tags["url"].includes("privategpt")
) {
return null;
}

return event;
},
});
10 changes: 8 additions & 2 deletions packages/ui/docs-bundle/sentry.edge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@

import * as Sentry from "@sentry/nextjs";

const sentryEnv = process?.env.NEXT_PUBLIC_APPLICATION_ENVIRONMENT ?? "dev";

Sentry.init({
// Do not enable sentry locally
enabled: process.env.NODE_ENV === "production",
dsn: "https://216ad381a8f652e036b1833af58627e5@o4507138224160768.ingest.us.sentry.io/4507148139495424",

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Performance Monitoring
tracesSampleRate: sentryEnv === "dev" ? 0.5 : 0.75, // Capture 75% of the transactions
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: sentryEnv === "dev" ? 0.5 : 0.75,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
Expand Down
15 changes: 9 additions & 6 deletions packages/ui/docs-bundle/sentry.server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@

import * as Sentry from "@sentry/nextjs";

const sentryEnv = process?.env.NEXT_PUBLIC_APPLICATION_ENVIRONMENT ?? "dev";

Sentry.init({
// Do not enable sentry locally
enabled: process.env.NODE_ENV === "production",
dsn: "https://216ad381a8f652e036b1833af58627e5@o4507138224160768.ingest.us.sentry.io/4507148139495424",

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Performance Monitoring
tracesSampleRate: sentryEnv === "dev" ? 0.5 : 0.75, // Capture 75% of the transactions
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: sentryEnv === "dev" ? 0.5 : 0.75,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
environment: process?.env.NEXT_PUBLIC_APPLICATION_ENVIRONMENT ?? "dev",

// uncomment the line below to enable Spotlight (https://spotlightjs.com)
// spotlight: process.env.NODE_ENV === 'development',
environment: sentryEnv,
});
4 changes: 2 additions & 2 deletions servers/fdr/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ Sentry.init({
nodeProfilingIntegration(),
],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
tracesSampleRate: config.applicationEnvironment == "prod" ? 0.75 : 0.5, // Capture 75% of the transactions
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,
profilesSampleRate: config.applicationEnvironment == "prod" ? 0.75 : 0.5,
environment: config.applicationEnvironment,
maxValueLength: 1000,
enabled: config.applicationEnvironment === "dev" || config.applicationEnvironment == "prod",
Expand Down
Loading