Merge branch 'sentry' into 'develop'
Optionally build with a Sentry endpoint, fixes #738 Closes #738 See merge request soapbox-pub/soapbox-fe!739
This commit is contained in:
@ -11,6 +11,7 @@ const {
|
||||
BACKEND_URL,
|
||||
FE_SUBDIRECTORY,
|
||||
FE_BUILD_DIR,
|
||||
SENTRY_DSN,
|
||||
} = process.env;
|
||||
|
||||
const sanitizeURL = url => {
|
||||
@ -38,4 +39,5 @@ module.exports = sanitize({
|
||||
BACKEND_URL: sanitizeURL(BACKEND_URL),
|
||||
FE_SUBDIRECTORY: sanitizeBasename(FE_SUBDIRECTORY),
|
||||
FE_BUILD_DIR: sanitizePath(FE_BUILD_DIR) || 'static',
|
||||
SENTRY_DSN,
|
||||
});
|
||||
|
||||
@ -2,6 +2,7 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import Bowser from 'bowser';
|
||||
import * as Sentry from '@sentry/browser';
|
||||
|
||||
export default class ErrorBoundary extends React.PureComponent {
|
||||
|
||||
@ -15,6 +16,8 @@ export default class ErrorBoundary extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidCatch(error, info) {
|
||||
Sentry.captureException(error);
|
||||
|
||||
this.setState({
|
||||
hasError: true,
|
||||
error,
|
||||
|
||||
@ -10,12 +10,16 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import * as OfflinePluginRuntime from '@lcdp/offline-plugin/runtime';
|
||||
import * as perf from './performance';
|
||||
import * as monitoring from './monitoring';
|
||||
import ready from './ready';
|
||||
import { NODE_ENV } from 'soapbox/build_config';
|
||||
|
||||
function main() {
|
||||
perf.start('main()');
|
||||
|
||||
// Sentry
|
||||
monitoring.start();
|
||||
|
||||
ready(() => {
|
||||
const mountNode = document.getElementById('soapbox');
|
||||
|
||||
|
||||
16
app/soapbox/monitoring.js
Normal file
16
app/soapbox/monitoring.js
Normal file
@ -0,0 +1,16 @@
|
||||
import * as Sentry from '@sentry/react';
|
||||
import { Integrations } from '@sentry/tracing';
|
||||
import { NODE_ENV, SENTRY_DSN } from 'soapbox/build_config';
|
||||
|
||||
export function start() {
|
||||
Sentry.init({
|
||||
dsn: SENTRY_DSN,
|
||||
environment: NODE_ENV,
|
||||
debug: false,
|
||||
integrations: [new Integrations.BrowserTracing()],
|
||||
|
||||
// We recommend adjusting this value in production, or using tracesSampler
|
||||
// for finer control
|
||||
tracesSampleRate: 1.0,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user