Skip to content

Commit

Permalink
Format and set Sentry only to run in production mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmontville committed Feb 28, 2024
1 parent fc18259 commit dc92b40
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import NavBar from '@/components/NavBar.vue';
import { useAuthStore } from '@/store/auth';
import { ref } from 'vue';
import { fetchDocById } from '@/helpers/query/utils';
import AppHead from './components/AppHead.vue';
import { i18n } from './translations/i18n';
import AppHead from '@/components/AppHead.vue';
import { i18n } from '@/translations/i18n';
import { useRoute } from 'vue-router';
const route = useRoute();
const pageTitle = computed(() => {
return route.meta?.pageTitle[i18n.global.locale.value] ?? route.meta?.pageTitle[i18n.global.fallbackLocale.value];
return route.meta?.pageTitle?.[i18n.global.locale.value] ?? route.meta?.pageTitle?.[i18n.global.fallbackLocale.value];
});
const navbarBlacklist = ref([
Expand Down
57 changes: 30 additions & 27 deletions src/sentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,35 @@ import { captureConsoleIntegration, contextLinesIntegration, extraErrorDataInteg
const regex = /https:\/\/roar-staging(--pr\d+-\w+)?\.web\.app/;

export function initSentry(app) {
Sentry.init({
app,
dsn: 'https://f15e3ff866394e93e00514b42113d03d@o4505913837420544.ingest.sentry.io/4506820782129152',
release: `${process.env.npm_package_name}@${process.env.npm_package_version}`,
integrations: [
Sentry.replayIntegration({
maskAllText: true,
maskAllInputs: true,
}),
Sentry.browserTracingIntegration(),
captureConsoleIntegration({
levels: ['warning', 'error', 'debug', 'assert'],
}),
contextLinesIntegration(),
extraErrorDataIntegration(),
],
attachStacktrace: true,
// Performance Monitoring
tracesSampleRate: 0.2, // Capture 20% of the transactions
tracePropagationTargets: ['localhost', 'https://roar.education/**/*', regex],
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
// Only initialize Sentry in production
if (process.env.NODE_ENV === 'production') {
Sentry.init({
app,
dsn: 'https://f15e3ff866394e93e00514b42113d03d@o4505913837420544.ingest.sentry.io/4506820782129152',
release: `${process.env.npm_package_name}@${process.env.npm_package_version}`,
integrations: [
Sentry.replayIntegration({
maskAllText: true,
maskAllInputs: true,
}),
Sentry.browserTracingIntegration(),
captureConsoleIntegration({
levels: ['warning', 'error', 'debug', 'assert'],
}),
contextLinesIntegration(),
extraErrorDataIntegration(),
],
attachStacktrace: true,
// Performance Monitoring
tracesSampleRate: 0.2, // Capture 20% of the transactions
tracePropagationTargets: ['localhost', 'https://roar.education/**/*', regex],
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.

beforeSend(event) {
return event;
},
});
beforeSend(event) {
return event;
},
});
}
}

0 comments on commit dc92b40

Please sign in to comment.