UNPKG

@nitra/vite-boot

Version:
53 lines (46 loc) 1.43 kB
import * as Sentry from '@sentry/vue' import { Integrations } from '@sentry/tracing' import { router } from './router.js' /** * Ініціалізація Sentry * @param app * @param tracing */ export const bootSentry = (app, tracing = 0) => { if (!import.meta.env.VITE_SENTRY) { return } const options = { app, dsn: import.meta.env.VITE_SENTRY, ignoreErrors: [ 'connection_error', 'Socket closed', 'ResizeObserver loop limit exceeded', 'Apollo client with id default not found', 'ResizeObserver loop completed with undelivered notifications' ], integrations: [] } // Якщо задано ідентифікатор коміту if (typeof __GITHUB_SHA__ !== 'undefined') { options.release = __GITHUB_SHA__ } if (tracing) { options.integrations.push( new Integrations.BrowserTracing({ routingInstrumentation: Sentry.vueRouterInstrumentation(router) }) ) // Set tracesSampleRate to 1.0 to capture 100% // of transactions for performance monitoring. // We recommend adjusting this value in production options.tracesSampleRate = tracing } // Якщо публікація з різних гілок // записуємо в різні енв для фільтрації в сентрі if (typeof __BRANCH__ !== 'undefined') { options.environment = __BRANCH__ } Sentry.init(options) }