chore: Sentry performance monitoring (#1841)
* Hook up performance monitoring * lint
This commit is contained in:
parent
11e1108f4a
commit
f6370ccf6d
11
app/index.js
11
app/index.js
|
@ -1,11 +1,12 @@
|
|||
// @flow
|
||||
import "focus-visible";
|
||||
import { createBrowserHistory } from "history";
|
||||
import { Provider } from "mobx-react";
|
||||
import * as React from "react";
|
||||
import { DndProvider } from "react-dnd";
|
||||
import { HTML5Backend } from "react-dnd-html5-backend";
|
||||
import { render } from "react-dom";
|
||||
import { BrowserRouter as Router } from "react-router-dom";
|
||||
import { Router } from "react-router-dom";
|
||||
import { initI18n } from "shared/i18n";
|
||||
import stores from "stores";
|
||||
import ErrorBoundary from "components/ErrorBoundary";
|
||||
|
@ -14,10 +15,16 @@ import Theme from "components/Theme";
|
|||
import Toasts from "components/Toasts";
|
||||
import Routes from "./routes";
|
||||
import env from "env";
|
||||
import { initSentry } from "utils/sentry";
|
||||
|
||||
initI18n();
|
||||
|
||||
const element = document.getElementById("root");
|
||||
const history = createBrowserHistory();
|
||||
|
||||
if (env.SENTRY_DSN) {
|
||||
initSentry(history);
|
||||
}
|
||||
|
||||
if (element) {
|
||||
render(
|
||||
|
@ -25,7 +32,7 @@ if (element) {
|
|||
<Theme>
|
||||
<ErrorBoundary>
|
||||
<DndProvider backend={HTML5Backend}>
|
||||
<Router>
|
||||
<Router history={history}>
|
||||
<>
|
||||
<ScrollToTop>
|
||||
<Routes />
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
// @flow
|
||||
import * as Sentry from "@sentry/react";
|
||||
import { Integrations } from "@sentry/tracing";
|
||||
import { type RouterHistory } from "react-router-dom";
|
||||
import env from "env";
|
||||
|
||||
export function initSentry(history: RouterHistory) {
|
||||
Sentry.init({
|
||||
dsn: env.SENTRY_DSN,
|
||||
integrations: [
|
||||
new Integrations.BrowserTracing({
|
||||
routingInstrumentation: Sentry.reactRouterV5Instrumentation(history),
|
||||
}),
|
||||
],
|
||||
tracesSampleRate: process.env.NODE_ENV === "production" ? 0.1 : 1,
|
||||
ignoreErrors: [
|
||||
"ResizeObserver loop limit exceeded",
|
||||
"AuthorizationError",
|
||||
"BadRequestError",
|
||||
"NetworkError",
|
||||
"NotFoundError",
|
||||
"OfflineError",
|
||||
"ServiceUnavailableError",
|
||||
"UpdateRequiredError",
|
||||
"ChunkLoadError",
|
||||
],
|
||||
});
|
||||
}
|
|
@ -69,6 +69,8 @@
|
|||
"@babel/preset-react": "^7.10.4",
|
||||
"@rehooks/window-scroll-position": "^1.0.1",
|
||||
"@sentry/node": "^5.23.0",
|
||||
"@sentry/react": "^6.0.1",
|
||||
"@sentry/tracing": "^6.0.1",
|
||||
"@tippy.js/react": "^2.2.2",
|
||||
"@tommoor/remove-markdown": "0.3.1",
|
||||
"autotrack": "^2.4.1",
|
||||
|
@ -148,7 +150,7 @@
|
|||
"react-keydown": "^1.7.3",
|
||||
"react-modal": "^3.1.2",
|
||||
"react-portal": "^4.0.0",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-virtualized-auto-sizer": "^1.0.2",
|
||||
"react-waypoint": "^9.0.2",
|
||||
"react-window": "^1.8.6",
|
||||
|
|
|
@ -52,7 +52,6 @@ const renderApp = async (ctx, next) => {
|
|||
.toString()
|
||||
.replace(/\/\/inject-env\/\//g, env)
|
||||
.replace(/\/\/inject-prefetch\/\//g, prefetchTags)
|
||||
.replace(/\/\/inject-sentry-dsn\/\//g, process.env.SENTRY_DSN || "")
|
||||
.replace(/\/\/inject-slack-app-id\/\//g, process.env.SLACK_APP_ID || "");
|
||||
};
|
||||
|
||||
|
|
|
@ -44,29 +44,7 @@
|
|||
<script>
|
||||
//inject-env//
|
||||
</script>
|
||||
<script
|
||||
src="https://browser.sentry-cdn.com/5.22.3/bundle.min.js"
|
||||
integrity="sha384-A1qzcXXJWl+bzYr+r8AdFzSaLbdcbYRFmG37MEDKr4EYjtraUyoZ6UiMw31jHcV9"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script>
|
||||
if ("//inject-sentry-dsn//" && window.Sentry) {
|
||||
window.Sentry.init({
|
||||
dsn: "//inject-sentry-dsn//",
|
||||
ignoreErrors: [
|
||||
"ResizeObserver loop limit exceeded",
|
||||
"AuthorizationError",
|
||||
"BadRequestError",
|
||||
"NetworkError",
|
||||
"NotFoundError",
|
||||
"OfflineError",
|
||||
"ServiceUnavailableError",
|
||||
"UpdateRequiredError",
|
||||
"ChunkLoadError",
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
if (window.localStorage && window.localStorage.getItem("theme") === "dark") {
|
||||
window.document.querySelector("#root").style.background = "#111319";
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ export const initI18n = () => {
|
|||
},
|
||||
lng,
|
||||
fallbackLng: lng,
|
||||
debug: process.env.NODE_ENV !== "production",
|
||||
debug: process.env.NODE_ENV === "development",
|
||||
keySeparator: false,
|
||||
});
|
||||
|
||||
|
|
79
yarn.lock
79
yarn.lock
|
@ -1415,6 +1415,16 @@
|
|||
execa "^4.0.0"
|
||||
java-properties "^1.0.0"
|
||||
|
||||
"@sentry/browser@6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.0.1.tgz#5d0b8e3bc893c1c7e55a9238e23ed47adf264fa2"
|
||||
integrity sha512-iP8Bqxj4Ye8CXA4ja77buPZfXsKiZYUgHFzBQxVMihTHA8ZZLgBMPLQI6uFfHuJJW+1/yLzOf8BhvF2zknAebg==
|
||||
dependencies:
|
||||
"@sentry/core" "6.0.1"
|
||||
"@sentry/types" "6.0.1"
|
||||
"@sentry/utils" "6.0.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/core@5.27.4":
|
||||
version "5.27.4"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.27.4.tgz#4155ee09ee4deed7364918094bf81654dcf681c0"
|
||||
|
@ -1426,6 +1436,17 @@
|
|||
"@sentry/utils" "5.27.4"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/core@6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.0.1.tgz#4024b2b04e5ce78ce35d7795a283fbd235f37757"
|
||||
integrity sha512-EoxgodyClasI8PA4GyU8Cp88W3R5ebpiLsE7fCcBcOU0DOBRkO8GAZ5IzfCDtYDJ50c9npivum5Oyj2wf8CXYw==
|
||||
dependencies:
|
||||
"@sentry/hub" "6.0.1"
|
||||
"@sentry/minimal" "6.0.1"
|
||||
"@sentry/types" "6.0.1"
|
||||
"@sentry/utils" "6.0.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/hub@5.27.4":
|
||||
version "5.27.4"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.27.4.tgz#15db6f504672edd70b793e4b3d370dca9cb2fef6"
|
||||
|
@ -1435,6 +1456,15 @@
|
|||
"@sentry/utils" "5.27.4"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/hub@6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.0.1.tgz#6a338522f62d6d6282822e16da4385a5a854f0a8"
|
||||
integrity sha512-pGckNdhKcr7qYVXgSgA/QVGArATcmQu54YFAR5xTnkWVHpAwNmh0fc4CJCc4JBwS/LXSU1Y0nYiLQduVfnv8Cg==
|
||||
dependencies:
|
||||
"@sentry/types" "6.0.1"
|
||||
"@sentry/utils" "6.0.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/minimal@5.27.4":
|
||||
version "5.27.4"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.27.4.tgz#2b331ed43d5f8999606fe9f8bf26a85155e8286c"
|
||||
|
@ -1444,6 +1474,15 @@
|
|||
"@sentry/types" "5.27.4"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/minimal@6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.0.1.tgz#f970a59b024d08e61e00d518081eb4b7591f3d77"
|
||||
integrity sha512-TQ/M5A+OsxtQJ8dzHwrclxKXpJNdQeM1PUoYhff4BvsOXJScvZb7+Yn0OUEQXEc9pSMNt62tnQy4ct80iAMTHw==
|
||||
dependencies:
|
||||
"@sentry/hub" "6.0.1"
|
||||
"@sentry/types" "6.0.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/node@^5.23.0":
|
||||
version "5.27.4"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-5.27.4.tgz#7fe327a45f865bff7c4b7f0d74d94506ec0a05bc"
|
||||
|
@ -1459,6 +1498,18 @@
|
|||
lru_map "^0.3.3"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/react@^6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.0.1.tgz#5b7f0284fee35b639cb4538096ee57bf3593792f"
|
||||
integrity sha512-loI9AnKp32yLRBGVZh5eVpAkpkGnCQ4rx+8GN+BICLwqsQTAJUyPLuyDarEqlH4sHOGJCwYf5s5Iu4uqpAP4vg==
|
||||
dependencies:
|
||||
"@sentry/browser" "6.0.1"
|
||||
"@sentry/minimal" "6.0.1"
|
||||
"@sentry/types" "6.0.1"
|
||||
"@sentry/utils" "6.0.1"
|
||||
hoist-non-react-statics "^3.3.2"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/tracing@5.27.4":
|
||||
version "5.27.4"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-5.27.4.tgz#0f6b0ebfa90b9f5bf5bac1fcf0f196010dbdddac"
|
||||
|
@ -1470,11 +1521,27 @@
|
|||
"@sentry/utils" "5.27.4"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/tracing@^6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.0.1.tgz#82001ce3369e05fe161e57dfb3cb3784fbe3f23b"
|
||||
integrity sha512-p4laeCu7isrvXiCgM/ix4GU5lckoL2Mw2OI3l93lRYL7fKU8XJs+/2Cybs0J+QY1HP5OTrNIF+VpnJZbpM6MQg==
|
||||
dependencies:
|
||||
"@sentry/hub" "6.0.1"
|
||||
"@sentry/minimal" "6.0.1"
|
||||
"@sentry/types" "6.0.1"
|
||||
"@sentry/utils" "6.0.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/types@5.27.4":
|
||||
version "5.27.4"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.27.4.tgz#ba7cefae6f77bb39a0ac59aeba1bb23ce4ad5216"
|
||||
integrity sha512-41h3c7tgtSS8UBmfvEckSr+7V7/IVOjt/EiydyOd6s0N18zSFfGY5HdA6g+eFtIJK3DhWkUHCHZNanD5IY5YCQ==
|
||||
|
||||
"@sentry/types@6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.0.1.tgz#4d1a281a4a79541b607361523e08058c6676409e"
|
||||
integrity sha512-cEoe19vtam75Tf6eWmaobfbeV8XwBdr5FJoSVTomzcSsEiP2FHGOEhlE7kVBigzeH5Lri0aibiW6BDi1hIqHdg==
|
||||
|
||||
"@sentry/utils@5.27.4":
|
||||
version "5.27.4"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.27.4.tgz#d57ccd72a56e2f97e109d632957f6cd11806e992"
|
||||
|
@ -1483,6 +1550,14 @@
|
|||
"@sentry/types" "5.27.4"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/utils@6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.0.1.tgz#061ef604df519e1488960484e9bf0cbcb8d8c9a4"
|
||||
integrity sha512-bjGuBYnG6fulZ8mLhPGBxttNu96DCN6d7Glw2sfLf4aurn1kjJ/58hP2c8dH0OqWO5e+rGYTsZ5Dr5kqVKNGTg==
|
||||
dependencies:
|
||||
"@sentry/types" "6.0.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sindresorhus/is@^0.7.0":
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"
|
||||
|
@ -5826,7 +5901,7 @@ hmac-drbg@^1.0.0:
|
|||
minimalistic-assert "^1.0.0"
|
||||
minimalistic-crypto-utils "^1.0.1"
|
||||
|
||||
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0:
|
||||
hoist-non-react-statics@^3.0.0, hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2:
|
||||
version "3.3.2"
|
||||
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
|
||||
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
|
||||
|
@ -9940,7 +10015,7 @@ react-portal@^4.0.0, react-portal@^4.2.1:
|
|||
dependencies:
|
||||
prop-types "^15.5.8"
|
||||
|
||||
react-router-dom@^5.1.2:
|
||||
react-router-dom@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.2.0.tgz#9e65a4d0c45e13289e66c7b17c7e175d0ea15662"
|
||||
integrity sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==
|
||||
|
|
Reference in New Issue