2023-03-04 22:38:38 +05:30
|
|
|
import * as Sentry from 'sentrybrowser7';
|
2023-01-13 00:05:48 +05:30
|
|
|
import { IGNORE_ERRORS, DENY_URLS, SAMPLE_RATE } from './constants';
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
const SentryConfig = {
|
2017-08-17 22:00:37 +05:30
|
|
|
init(options = {}) {
|
|
|
|
this.options = options;
|
|
|
|
|
|
|
|
this.configure();
|
|
|
|
if (this.options.currentUserId) this.setUser();
|
|
|
|
},
|
|
|
|
|
|
|
|
configure() {
|
2023-03-04 22:38:38 +05:30
|
|
|
const { dsn, release, tags, allowUrls, environment } = this.options;
|
2021-09-30 23:02:18 +05:30
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
Sentry.init({
|
|
|
|
dsn,
|
|
|
|
release,
|
2023-03-04 22:38:38 +05:30
|
|
|
allowUrls,
|
2019-12-26 22:10:19 +05:30
|
|
|
environment,
|
2023-03-04 22:38:38 +05:30
|
|
|
ignoreErrors: IGNORE_ERRORS,
|
|
|
|
denyUrls: DENY_URLS,
|
2019-12-26 22:10:19 +05:30
|
|
|
sampleRate: SAMPLE_RATE,
|
|
|
|
});
|
2021-09-30 23:02:18 +05:30
|
|
|
|
|
|
|
Sentry.setTags(tags);
|
2017-08-17 22:00:37 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
setUser() {
|
2019-12-26 22:10:19 +05:30
|
|
|
Sentry.setUser({
|
2017-08-17 22:00:37 +05:30
|
|
|
id: this.options.currentUserId,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
export default SentryConfig;
|