forked from jitsi/jitsi-meet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsentry.js
42 lines (35 loc) · 1.25 KB
/
sentry.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* eslint-disable */
import * as Sentry from "@sentry/react"
import logger from './react/features/app/logger';
export const notifySentry = (error)=>{
if (Sentry && window.hasSentryInitialized) {
Sentry.captureMessage(error)
}
}
export const initSentry = () => {
const releaseStage = process.env.NODE_ENV;
const version = process.env.APP_VERSION;
const SENTRY_DSN_KEY = process.env.SENTRY_DSN || "https://8b81f2744c0a5a73d15aa61497cd50a0@o4505290921410560.ingest.sentry.io/4505783957192704";
if (!SENTRY_DSN_KEY) {
logger.warn('Sentry DSN is missing. Sentry will not be initialized.');
return false;
}
if (navigator.product === 'ReactNative' || releaseStage !== "production") {
logger.warn('Not in a valid environment. Sentry will not be initialized.');
return false;
}
try {
Sentry.init({
dsn: SENTRY_DSN_KEY,
integrations: [new Sentry.BrowserTracing()],
environment: releaseStage,
release: `jitsi-frontend@${version}`,
tracesSampleRate: 0.1,
});
logger.info('Sentry has been initialized');
} catch (error) {
logger.info('Error initializing Sentry.');
return false;
}
return true;
};