Skip to content

Commit

Permalink
refactor: only enable sentry in prod
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshift committed Jan 6, 2025
1 parent 8b1ae81 commit 878e6f7
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 36 deletions.
40 changes: 21 additions & 19 deletions sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,31 @@
import * as Sentry from '@sentry/nextjs';
// import * as Spotlight from '@spotlightjs/spotlight';

Sentry.init({
dsn: 'https://0d295254822c41989ea49baec3c31a6d@o4504495959703552.ingest.us.sentry.io/4504526099447808',
if (process.env.NODE_ENV === 'production') {
Sentry.init({
dsn: 'https://0d295254822c41989ea49baec3c31a6d@o4504495959703552.ingest.us.sentry.io/4504526099447808',

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
replaysOnErrorSampleRate: 1.0,
// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,
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: 0.1,
// 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: 0.1,

// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
Sentry.replayIntegration({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
Sentry.replayIntegration({
// Additional Replay configuration goes in here, for example:
maskAllText: true,
blockAllMedia: true,
}),
],
});
}

// if (process.env.NODE_ENV === 'development') {
// Spotlight.init();
Expand Down
18 changes: 10 additions & 8 deletions sentry.edge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

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

Sentry.init({
dsn: 'https://0d295254822c41989ea49baec3c31a6d@o4504495959703552.ingest.us.sentry.io/4504526099447808',
if (process.env.NODE_ENV === 'production') {
Sentry.init({
dsn: 'https://0d295254822c41989ea49baec3c31a6d@o4504495959703552.ingest.us.sentry.io/4504526099447808',

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

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

// spotlight: process.env.NODE_ENV === 'development',
});
// spotlight: process.env.NODE_ENV === 'development',
});
}
20 changes: 11 additions & 9 deletions sentry.server.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@

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

Sentry.init({
dsn: 'https://0d295254822c41989ea49baec3c31a6d@o4504495959703552.ingest.us.sentry.io/4504526099447808',
if (process.env.NODE_ENV === 'production') {
Sentry.init({
dsn: 'https://0d295254822c41989ea49baec3c31a6d@o4504495959703552.ingest.us.sentry.io/4504526099447808',

// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,
// Adjust this value in production, or use tracesSampler for greater control
tracesSampleRate: 1,

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

// Uncomment the line below to enable Spotlight (https://spotlightjs.com)
// spotlight: process.env.NODE_ENV === 'development',
});
// Uncomment the line below to enable Spotlight (https://spotlightjs.com)
// spotlight: process.env.NODE_ENV === 'development',
});
}

0 comments on commit 878e6f7

Please sign in to comment.