Adding Sentry.io

This commit is contained in:
Jeff Avallone 2018-02-11 10:41:03 -05:00
parent 6bf094a4c1
commit b009d078b6
7 changed files with 29 additions and 3 deletions

View File

@ -47,6 +47,7 @@
"npm-run-all": "^4.1.2",
"postcss-loader": "^2.1.0",
"precss": "^3.1.0",
"raven-js": "^3.22.2",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-ga": "^2.4.1",

View File

@ -17,7 +17,7 @@ const PageTemplate = ({ title, children }) => (
<title>Regexper{ title && (' - ' + title) }</title>
</head>
<body>
<body data-build-id={ process.env.BUILD_ID }>
<header id="main" data-banner={ process.env.BANNER }>
<h1>
<a href="/">Regexper</a>

View File

@ -1,4 +1,6 @@
import '../../style.css';
import { setupGA } from '../../analytics';
import { setupRaven } from '../../sentry';
setupRaven();
setupGA();

View File

@ -6,10 +6,12 @@ import App from '../../components/App';
import '../../style.css';
import { setupServiceWorker } from '../../service-worker';
import { setupGA } from '../../analytics';
import { setupRaven } from '../../sentry';
setupRaven();
setupGA();
if (process.env.NODE_ENV === 'production') {
setupServiceWorker();
}
setupGA();
ReactDOM.render(<App/>, document.getElementById('root'));

12
src/sentry.js Normal file
View File

@ -0,0 +1,12 @@
import Raven from 'raven-js';
const setupRaven = () => {
Raven.config(process.env.SENTRY_KEY, {
whitelistUrls: [/https:\/\/(.*\.)?regexper\.com/],
environment: process.env.NODE_ENV,
debug: (process.env.NODE_ENV !== 'production'),
release: process.env.BUILD_ID
});
};
export { setupRaven };

View File

@ -41,7 +41,12 @@ module.exports = {
NODE_ENV: 'development',
GA_PROPERTY: null,
SENTRY_KEY: null,
BANNER: process.env.NODE_ENV === 'production' ? null : (process.env.NODE_ENV || 'development')
BANNER: process.env.NODE_ENV === 'production' ? null : (process.env.NODE_ENV || 'development'),
BUILD_ID: [
process.env.CIRCLE_BRANCH || 'prerelease',
process.env.CIRCLE_BUILD_NUM || '##',
(process.env.CIRCLE_SHA1 || 'gitsha').slice(-7)
].join('-')
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',

View File

@ -6217,6 +6217,10 @@ range-parser@^1.0.3, range-parser@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e"
raven-js@^3.22.2:
version "3.22.2"
resolved "https://registry.yarnpkg.com/raven-js/-/raven-js-3.22.2.tgz#85785928ebd664049e54efd0db8ff28da0cbb374"
raw-body@2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.2.tgz#bcd60c77d3eb93cde0050295c3f379389bc88f89"