Skip to content

Commit

Permalink
Merge branch 'sentry-sample-env' into 'master'
Browse files Browse the repository at this point in the history
add env var for sentry sample rate

See merge request kchat/webapp!877
  • Loading branch information
antonbuks committed Aug 15, 2024
2 parents 3d6bbf5 + 422663a commit 95258f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webapp/channels/src/utils/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ interface Args {
}

// Webpack global var
declare const GIT_RELEASE: string;
declare const GIT_RELEASE: ReturnType<JSON['stringify']>;
declare const SENTRY_PERFORMANCE_SAMPLE_RATE: ReturnType<JSON['stringify']>;

const isLocalhost = (host: string) => host.startsWith('localhost') || host.startsWith('infomaniak.local.') || host.startsWith('kchat.local.') || host.startsWith('local.') || host.startsWith('kchat.devd');
const isCanaryOrPreprod = GIT_RELEASE.includes('-next') || GIT_RELEASE.includes('-rc');
Expand Down Expand Up @@ -40,7 +41,7 @@ export default function init({SENTRY_DSN}: Args) {
isCanaryOrPreprod && new Sentry.BrowserTracing(),
isCanaryOrPreprod && new Sentry.Replay(),
].filter(bool),
tracesSampleRate: 0.1,
tracesSampleRate: parseFloat(SENTRY_PERFORMANCE_SAMPLE_RATE),
ignoreErrors: [

// Ignore random plugins/extensions
Expand Down
2 changes: 2 additions & 0 deletions webapp/channels/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ if (DEV) {
env.MANAGER_ENDPOINT = JSON.stringify(process.env.MANAGER_ENDPOINT || 'https://manager.preprod.dev.infomaniak.ch/');
env.LOGIN_ENDPOINT = JSON.stringify(process.env.LOGIN_ENDPOINT || 'https://login.preprod.dev.infomaniak.ch/');
env.BASE_URL = JSON.stringify(process.env.BASE_URL || 'https://kchat.preprod.dev.infomaniak.ch');
env.SENTRY_PERFORMANCE_SAMPLE_RATE = JSON.stringify(process.env.SENTRY_PERFORMANCE_SAMPLE_RATE || 0);
if (process.env.MM_LIVE_RELOAD) {
config.plugins.push(new LiveReloadPlugin());
}
Expand All @@ -472,6 +473,7 @@ if (DEV) {
env.MANAGER_ENDPOINT = JSON.stringify(process.env.MANAGER_ENDPOINT || 'https://manager.infomaniak.com/');
env.LOGIN_ENDPOINT = JSON.stringify(process.env.LOGIN_ENDPOINT || 'https://login.infomaniak.com/');
env.BASE_URL = JSON.stringify(process.env.BASE_URL || 'https://kchat.infomaniak.com');
env.SENTRY_PERFORMANCE_SAMPLE_RATE = JSON.stringify(process.env.SENTRY_PERFORMANCE_SAMPLE_RATE || 0);
}

config.plugins.push(new webpack.DefinePlugin({
Expand Down

0 comments on commit 95258f2

Please sign in to comment.