diff --git a/.github/workflows/sentry-release.yml b/.github/workflows/sentry-release.yml
new file mode 100644
index 0000000..3f8a10c
--- /dev/null
+++ b/.github/workflows/sentry-release.yml
@@ -0,0 +1,46 @@
+name: Sentry Release
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - master
+
+permissions: # added using https://github.com/step-security/secure-workflows
+ contents: read
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+ environment: production
+ outputs:
+ version: ${{ steps.set-version.outputs.version }}
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v2
+ with:
+ node-version: 16
+
+ - name: Install dependencies
+ run: yarn install
+
+ - name: Build and deploy subgraph
+ run: yarn build
+
+ - name: Set version
+ id: set-version
+ run: echo "version=v$(cat package.json | jq -r .version)-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
+
+ - name: Create Sentry release
+ uses: getsentry/action-release@v1.2.1
+ env:
+ SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
+ SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
+ SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
+ with:
+ environment: production
+ version: ${{ steps.set-version.outputs.version }}
+ sourcemaps: ./dist
+
diff --git a/package.json b/package.json
index 40389a3..d3ebe65 100644
--- a/package.json
+++ b/package.json
@@ -41,6 +41,8 @@
"@loadable/component": "^5.12.0",
"@reduxjs/toolkit": "^1.6.1",
"@rehooks/local-storage": "^2.4.4",
+ "@sentry/react": "^7.37.2",
+ "@sentry/tracing": "^7.37.2",
"@uniswap/sdk": "^3.0.3",
"@web3-react/abstract-connector": "^6.0.7",
"@web3-react/core": "^6.1.9",
diff --git a/scripts/sentry-release.sh b/scripts/sentry-release.sh
new file mode 100755
index 0000000..71dbb10
--- /dev/null
+++ b/scripts/sentry-release.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+
+cd $SCRIPT_DIR/..
+
+version="linguo@v$(cat package.json | jq -r .version)-$(git rev-parse --short HEAD)"
+sentry-cli releases new "$version"
+sentry-cli releases set-commits "$version" --auto
+
+rm -rf dist/
+yarn build
+sentry-cli releases files $version upload-sourcemaps dist/
+
+sentry-cli releases finalize "$version"
+
+cd -
diff --git a/src/app/MainRouter.jsx b/src/app/MainRouter.jsx
index 9a13a6d..38bc136 100644
--- a/src/app/MainRouter.jsx
+++ b/src/app/MainRouter.jsx
@@ -2,7 +2,7 @@ import React from 'react';
import { SWRConfig } from 'swr';
import { request } from 'graphql-request';
-import { Redirect, Route, Switch } from 'react-router-dom';
+import { Redirect, Switch } from 'react-router-dom';
import loadable from '@loadable/component';
import { Layout } from 'antd';
import { ConnectedRouter } from 'connected-react-router';
@@ -15,7 +15,7 @@ import Footer from '~/layout/Footer';
import Navbar from '~/layout/Header/Navbar';
import { DrawerMenu } from '~/layout/Header/Menu';
-import { history } from '~/store';
+import { history, SentryRoute } from '~/store';
import Content from './Content';
import Web3ConnectionManager from '~/components/Web3ConnectionManager';
import GlobalWarnings from '~/components/GlobalWarnings';
@@ -67,30 +67,30 @@ export default function MainRouter() {
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
diff --git a/src/index.jsx b/src/index.jsx
index 363d202..9f84007 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -4,12 +4,25 @@ import { Titled } from 'react-titled';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
+import * as Sentry from '@sentry/react';
+import { BrowserTracing } from '@sentry/tracing';
import { Spin } from '~/adapters/antd';
-import store, { persistor } from './store';
+import store, { persistor, history } from './store';
import App from './app/App';
const loading = ;
+Sentry.init({
+ dsn: process.env.REACT_APP_SENTRY_ENDPOINT,
+ environment: process.env.REACT_APP_CONTEXT,
+ integrations: [
+ new BrowserTracing({
+ routingInstrumentation: Sentry.reactRouterV5Instrumentation(history),
+ }),
+ ],
+ tracesSampleRate: 1.0,
+});
+
render(
diff --git a/src/store/history.js b/src/store/history.js
index 997ede5..7e972de 100644
--- a/src/store/history.js
+++ b/src/store/history.js
@@ -1,4 +1,8 @@
import { createBrowserHistory } from 'history';
+import { Route } from 'react-router-dom';
+import * as Sentry from '@sentry/react';
+
+export const SentryRoute = Sentry.withSentryRouting(Route);
const history = createBrowserHistory();
export default history;
diff --git a/src/store/index.js b/src/store/index.js
index 15eb69b..5526887 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -1,2 +1,2 @@
export { default, persistor, runSaga } from './store';
-export { default as history } from './history';
+export { default as history, SentryRoute } from './history';
diff --git a/yarn.lock b/yarn.lock
index 475618c..46a25cb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2926,6 +2926,69 @@
dependencies:
any-observable "^0.3.0"
+"@sentry/browser@7.37.2":
+ version "7.37.2"
+ resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.37.2.tgz#355dd28ad12677d63e0b12c5209d12b3f98ac3a4"
+ integrity sha512-UvKfpx6+BUdV+rGAXqDBznagfz44Ut+x2h/i0OZPNCEpXaH9KAQOlv06I66861aXiucWFRb1lAMrN4+cE9aJIg==
+ dependencies:
+ "@sentry/core" "7.37.2"
+ "@sentry/replay" "7.37.2"
+ "@sentry/types" "7.37.2"
+ "@sentry/utils" "7.37.2"
+ tslib "^1.9.3"
+
+"@sentry/core@7.37.2":
+ version "7.37.2"
+ resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.37.2.tgz#959b2bf953f442b07f8377d90f4f7735cf260ae4"
+ integrity sha512-LjofMDSTyVeBErl9N7TTqlyEVuW1g6U4iuJtdZ75JohnvVxzWdpZfWfddwQ6h7nGWfe9dNg0fGs1wxKtMhY+MA==
+ dependencies:
+ "@sentry/types" "7.37.2"
+ "@sentry/utils" "7.37.2"
+ tslib "^1.9.3"
+
+"@sentry/react@^7.37.2":
+ version "7.37.2"
+ resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.37.2.tgz#f5ecc4071c5dd0e8446103c24e94edda520a1217"
+ integrity sha512-e5NFQAwHSGVyMUGYjvYXLI/QECkXkZ2BNUo+OHr5mAYqcIyGSA38tX7RJetrhonVjjpJp/ZVzlOyxQkpnBfBLw==
+ dependencies:
+ "@sentry/browser" "7.37.2"
+ "@sentry/types" "7.37.2"
+ "@sentry/utils" "7.37.2"
+ hoist-non-react-statics "^3.3.2"
+ tslib "^1.9.3"
+
+"@sentry/replay@7.37.2":
+ version "7.37.2"
+ resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.37.2.tgz#eb49b7a1286335c1a4de49b386d0258e5c789682"
+ integrity sha512-y8Gfc7EGfGU4eVae5HAtch2YgkiTzNPi16dcqPX9jtIHDwiurGqWcaOgs5HoGJm45eMfl6LvcE7MPbwqcDkPIA==
+ dependencies:
+ "@sentry/core" "7.37.2"
+ "@sentry/types" "7.37.2"
+ "@sentry/utils" "7.37.2"
+
+"@sentry/tracing@^7.37.2":
+ version "7.37.2"
+ resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-7.37.2.tgz#88f149aea6a4d5a3cfb9145868d885fac9fffb52"
+ integrity sha512-XBVvxbV5TADq2rHg/kJqGqDfOP8n2myMUxMMpfHMb38NrxkxQwXy+gDe41bA8FJKA2k7Y3Wkn8ZC/PelQ8c+ag==
+ dependencies:
+ "@sentry/core" "7.37.2"
+ "@sentry/types" "7.37.2"
+ "@sentry/utils" "7.37.2"
+ tslib "^1.9.3"
+
+"@sentry/types@7.37.2":
+ version "7.37.2"
+ resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.37.2.tgz#99fd76230d7c1d3c6901ed4c0bea35be7d6fe26d"
+ integrity sha512-SxKQOCX94ZaQM4C2ysNjHdJsjYapu/NYZCz1cnPyCdDvYfhwiVge1uq6ZHiQ/ARfxAAOmc3R4Mh3VvEz7WUOdw==
+
+"@sentry/utils@7.37.2":
+ version "7.37.2"
+ resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.37.2.tgz#14dea644454e3df247fb113fc834f509c1f0e48c"
+ integrity sha512-5irN1nN/mtdOoWwsJiwBK0gPgNMkciUubEMbCaaXqJaGyGz8+yfDvXj7L+xGYiU57z+7+QkkSKxKEZ/IcBpjVQ==
+ dependencies:
+ "@sentry/types" "7.37.2"
+ tslib "^1.9.3"
+
"@sindresorhus/is@^0.14.0":
version "0.14.0"
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
@@ -13969,7 +14032,7 @@ tsconfig-paths@^3.11.0:
minimist "^1.2.0"
strip-bom "^3.0.0"
-tslib@1.14.1:
+tslib@1.14.1, tslib@^1.9.3:
version "1.14.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==