Add Sentry support
This commit is contained in:
		
					parent
					
						
							
								0067212512
							
						
					
				
			
			
				commit
				
					
						9ecfaa4ddb
					
				
			
		
					 5 changed files with 110 additions and 10 deletions
				
			
		
							
								
								
									
										3
									
								
								.env
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								.env
									
										
									
									
									
								
							| 
						 | 
					@ -6,3 +6,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# The room id for the space to use for listing public group call rooms
 | 
					# The room id for the space to use for listing public group call rooms
 | 
				
			||||||
# VITE_PUBLIC_SPACE_ROOM_ID=!hjdfshkdskjdsk:myhomeserver.com
 | 
					# VITE_PUBLIC_SPACE_ROOM_ID=!hjdfshkdskjdsk:myhomeserver.com
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# The Sentry DSN to use for error reporting. Leave undefined to disable.
 | 
				
			||||||
 | 
					# VITE_SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,8 @@
 | 
				
			||||||
    "serve": "vite preview"
 | 
					    "serve": "vite preview"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "dependencies": {
 | 
					  "dependencies": {
 | 
				
			||||||
 | 
					    "@sentry/react": "^6.13.3",
 | 
				
			||||||
 | 
					    "@sentry/tracing": "^6.13.3",
 | 
				
			||||||
    "classnames": "^2.3.1",
 | 
					    "classnames": "^2.3.1",
 | 
				
			||||||
    "color-hash": "^2.0.1",
 | 
					    "color-hash": "^2.0.1",
 | 
				
			||||||
    "events": "^3.3.0",
 | 
					    "events": "^3.3.0",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										19
									
								
								src/App.jsx
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								src/App.jsx
									
										
									
									
									
								
							| 
						 | 
					@ -22,6 +22,7 @@ import {
 | 
				
			||||||
  Redirect,
 | 
					  Redirect,
 | 
				
			||||||
  useLocation,
 | 
					  useLocation,
 | 
				
			||||||
} from "react-router-dom";
 | 
					} from "react-router-dom";
 | 
				
			||||||
 | 
					import * as Sentry from "@sentry/react";
 | 
				
			||||||
import { useClient } from "./ConferenceCallManagerHooks";
 | 
					import { useClient } from "./ConferenceCallManagerHooks";
 | 
				
			||||||
import { Home } from "./Home";
 | 
					import { Home } from "./Home";
 | 
				
			||||||
import { Room } from "./Room";
 | 
					import { Room } from "./Room";
 | 
				
			||||||
| 
						 | 
					@ -30,6 +31,8 @@ import { LoginPage } from "./LoginPage";
 | 
				
			||||||
import { Center } from "./Layout";
 | 
					import { Center } from "./Layout";
 | 
				
			||||||
import { GuestAuthPage } from "./GuestAuthPage";
 | 
					import { GuestAuthPage } from "./GuestAuthPage";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const SentryRoute = Sentry.withSentryRouting(Route);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function App() {
 | 
					export default function App() {
 | 
				
			||||||
  const { protocol, host } = window.location;
 | 
					  const { protocol, host } = window.location;
 | 
				
			||||||
  // Assume homeserver is hosted on same domain (proxied in development by vite)
 | 
					  // Assume homeserver is hosted on same domain (proxied in development by vite)
 | 
				
			||||||
| 
						 | 
					@ -56,19 +59,19 @@ export default function App() {
 | 
				
			||||||
            <AuthenticatedRoute authenticated={authenticated} exact path="/">
 | 
					            <AuthenticatedRoute authenticated={authenticated} exact path="/">
 | 
				
			||||||
              <Home client={client} onLogout={logout} />
 | 
					              <Home client={client} onLogout={logout} />
 | 
				
			||||||
            </AuthenticatedRoute>
 | 
					            </AuthenticatedRoute>
 | 
				
			||||||
            <Route exact path="/login">
 | 
					            <SentryRoute exact path="/login">
 | 
				
			||||||
              <LoginPage onLogin={login} />
 | 
					              <LoginPage onLogin={login} />
 | 
				
			||||||
            </Route>
 | 
					            </SentryRoute>
 | 
				
			||||||
            <Route exact path="/register">
 | 
					            <SentryRoute exact path="/register">
 | 
				
			||||||
              <RegisterPage onRegister={register} />
 | 
					              <RegisterPage onRegister={register} />
 | 
				
			||||||
            </Route>
 | 
					            </SentryRoute>
 | 
				
			||||||
            <Route path="/room/:roomId">
 | 
					            <SentryRoute path="/room/:roomId">
 | 
				
			||||||
              {authenticated ? (
 | 
					              {authenticated ? (
 | 
				
			||||||
                <Room client={client} />
 | 
					                <Room client={client} />
 | 
				
			||||||
              ) : (
 | 
					              ) : (
 | 
				
			||||||
                <GuestAuthPage onRegisterGuest={registerGuest} />
 | 
					                <GuestAuthPage onRegisterGuest={registerGuest} />
 | 
				
			||||||
              )}
 | 
					              )}
 | 
				
			||||||
            </Route>
 | 
					            </SentryRoute>
 | 
				
			||||||
          </Switch>
 | 
					          </Switch>
 | 
				
			||||||
        )}
 | 
					        )}
 | 
				
			||||||
      </>
 | 
					      </>
 | 
				
			||||||
| 
						 | 
					@ -80,7 +83,7 @@ function AuthenticatedRoute({ authenticated, children, ...rest }) {
 | 
				
			||||||
  const location = useLocation();
 | 
					  const location = useLocation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <Route {...rest}>
 | 
					    <SentryRoute {...rest}>
 | 
				
			||||||
      {authenticated ? (
 | 
					      {authenticated ? (
 | 
				
			||||||
        children
 | 
					        children
 | 
				
			||||||
      ) : (
 | 
					      ) : (
 | 
				
			||||||
| 
						 | 
					@ -91,6 +94,6 @@ function AuthenticatedRoute({ authenticated, children, ...rest }) {
 | 
				
			||||||
          }}
 | 
					          }}
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
      )}
 | 
					      )}
 | 
				
			||||||
    </Route>
 | 
					    </SentryRoute>
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										19
									
								
								src/main.jsx
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								src/main.jsx
									
										
									
									
									
								
							| 
						 | 
					@ -16,12 +16,29 @@ limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import React from "react";
 | 
					import React from "react";
 | 
				
			||||||
import ReactDOM from "react-dom";
 | 
					import ReactDOM from "react-dom";
 | 
				
			||||||
 | 
					import { createBrowserHistory } from "history";
 | 
				
			||||||
import "./index.css";
 | 
					import "./index.css";
 | 
				
			||||||
import App from "./App";
 | 
					import App from "./App";
 | 
				
			||||||
 | 
					import * as Sentry from "@sentry/react";
 | 
				
			||||||
 | 
					import { Integrations } from "@sentry/tracing";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const history = createBrowserHistory();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Sentry.init({
 | 
				
			||||||
 | 
					  dsn: import.meta.env.VITE_SENTRY_DSN,
 | 
				
			||||||
 | 
					  integrations: [
 | 
				
			||||||
 | 
					    new Integrations.BrowserTracing({
 | 
				
			||||||
 | 
					      routingInstrumentation: Sentry.reactRouterV5Instrumentation(history),
 | 
				
			||||||
 | 
					    }),
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  tracesSampleRate: 1.0,
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ReactDOM.render(
 | 
					ReactDOM.render(
 | 
				
			||||||
  <React.StrictMode>
 | 
					  <React.StrictMode>
 | 
				
			||||||
    <App />
 | 
					    <Sentry.ErrorBoundary fallback={<p>An error has occurred</p>}>
 | 
				
			||||||
 | 
					      <App history={history} />
 | 
				
			||||||
 | 
					    </Sentry.ErrorBoundary>
 | 
				
			||||||
  </React.StrictMode>,
 | 
					  </React.StrictMode>,
 | 
				
			||||||
  document.getElementById("root")
 | 
					  document.getElementById("root")
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										75
									
								
								yarn.lock
									
										
									
									
									
								
							
							
						
						
									
										75
									
								
								yarn.lock
									
										
									
									
									
								
							| 
						 | 
					@ -253,6 +253,16 @@
 | 
				
			||||||
    "@react-spring/shared" "~9.2.0"
 | 
					    "@react-spring/shared" "~9.2.0"
 | 
				
			||||||
    "@react-spring/types" "~9.2.0"
 | 
					    "@react-spring/types" "~9.2.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"@sentry/browser@6.13.3":
 | 
				
			||||||
 | 
					  version "6.13.3"
 | 
				
			||||||
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.13.3.tgz#d4511791b1e484ad48785eba3bce291fdf115c1e"
 | 
				
			||||||
 | 
					  integrity sha512-jwlpsk2/u1cofvfYsjmqcnx50JJtf/T6HTgdW+ih8+rqWC5ABEZf4IiB/H+KAyjJ3wVzCOugMq5irL83XDCfqQ==
 | 
				
			||||||
 | 
					  dependencies:
 | 
				
			||||||
 | 
					    "@sentry/core" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/types" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/utils" "6.13.3"
 | 
				
			||||||
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"@sentry/browser@^6.11.0":
 | 
					"@sentry/browser@^6.11.0":
 | 
				
			||||||
  version "6.13.2"
 | 
					  version "6.13.2"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.13.2.tgz#8b731ecf8c3cdd92a4b6893a26f975fd5844056d"
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.13.2.tgz#8b731ecf8c3cdd92a4b6893a26f975fd5844056d"
 | 
				
			||||||
| 
						 | 
					@ -274,6 +284,17 @@
 | 
				
			||||||
    "@sentry/utils" "6.13.2"
 | 
					    "@sentry/utils" "6.13.2"
 | 
				
			||||||
    tslib "^1.9.3"
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"@sentry/core@6.13.3":
 | 
				
			||||||
 | 
					  version "6.13.3"
 | 
				
			||||||
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.13.3.tgz#5cbbb995128e793ebebcbf1d3b7514e0e5e8b221"
 | 
				
			||||||
 | 
					  integrity sha512-obm3SjgCk8A7nB37b2AU1eq1q7gMoJRrGMv9VRIyfcG0Wlz/5lJ9O3ohUk+YZaaVfZMxXn6hFtsBiOWmlv7IIA==
 | 
				
			||||||
 | 
					  dependencies:
 | 
				
			||||||
 | 
					    "@sentry/hub" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/minimal" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/types" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/utils" "6.13.3"
 | 
				
			||||||
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"@sentry/hub@6.13.2":
 | 
					"@sentry/hub@6.13.2":
 | 
				
			||||||
  version "6.13.2"
 | 
					  version "6.13.2"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.13.2.tgz#ebc66fd55c96c7686a53ffd3521b6a63f883bb79"
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.13.2.tgz#ebc66fd55c96c7686a53ffd3521b6a63f883bb79"
 | 
				
			||||||
| 
						 | 
					@ -283,6 +304,15 @@
 | 
				
			||||||
    "@sentry/utils" "6.13.2"
 | 
					    "@sentry/utils" "6.13.2"
 | 
				
			||||||
    tslib "^1.9.3"
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"@sentry/hub@6.13.3":
 | 
				
			||||||
 | 
					  version "6.13.3"
 | 
				
			||||||
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.13.3.tgz#cc09623a69b5343315fdb61c7fdd0be74b72299f"
 | 
				
			||||||
 | 
					  integrity sha512-eYppBVqvhs5cvm33snW2sxfcw6G20/74RbBn+E4WDo15hozis89kU7ZCJDOPkXuag3v1h9igns/kM6PNBb41dw==
 | 
				
			||||||
 | 
					  dependencies:
 | 
				
			||||||
 | 
					    "@sentry/types" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/utils" "6.13.3"
 | 
				
			||||||
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"@sentry/minimal@6.13.2":
 | 
					"@sentry/minimal@6.13.2":
 | 
				
			||||||
  version "6.13.2"
 | 
					  version "6.13.2"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.13.2.tgz#de3ecc62b9463bf56ccdbcf4c75f7ea1aeeebc11"
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.13.2.tgz#de3ecc62b9463bf56ccdbcf4c75f7ea1aeeebc11"
 | 
				
			||||||
| 
						 | 
					@ -292,6 +322,27 @@
 | 
				
			||||||
    "@sentry/types" "6.13.2"
 | 
					    "@sentry/types" "6.13.2"
 | 
				
			||||||
    tslib "^1.9.3"
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"@sentry/minimal@6.13.3":
 | 
				
			||||||
 | 
					  version "6.13.3"
 | 
				
			||||||
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.13.3.tgz#a675a79bcc830142e4f95e6198a2efde2cd3901e"
 | 
				
			||||||
 | 
					  integrity sha512-63MlYYRni3fs5Bh8XBAfVZ+ctDdWg0fapSTP1ydIC37fKvbE+5zhyUqwrEKBIiclEApg1VKX7bkKxVdu/vsFdw==
 | 
				
			||||||
 | 
					  dependencies:
 | 
				
			||||||
 | 
					    "@sentry/hub" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/types" "6.13.3"
 | 
				
			||||||
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"@sentry/react@^6.13.3":
 | 
				
			||||||
 | 
					  version "6.13.3"
 | 
				
			||||||
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/react/-/react-6.13.3.tgz#f9607e0a60d52efd0baa96a14e694b6059f9379a"
 | 
				
			||||||
 | 
					  integrity sha512-fdfmD9XNpGDwdkeLyd+iq+kqtNeghpH3wiez2rD81ZBvrn70uKaO2/yYDE71AXC6fUOwQuJmdfAuqBcNJkYIEw==
 | 
				
			||||||
 | 
					  dependencies:
 | 
				
			||||||
 | 
					    "@sentry/browser" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/minimal" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/types" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/utils" "6.13.3"
 | 
				
			||||||
 | 
					    hoist-non-react-statics "^3.3.2"
 | 
				
			||||||
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"@sentry/tracing@^6.11.0":
 | 
					"@sentry/tracing@^6.11.0":
 | 
				
			||||||
  version "6.13.2"
 | 
					  version "6.13.2"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.13.2.tgz#512389ba459f48ae75e14f1528ab062dc46e4956"
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.13.2.tgz#512389ba459f48ae75e14f1528ab062dc46e4956"
 | 
				
			||||||
| 
						 | 
					@ -303,11 +354,27 @@
 | 
				
			||||||
    "@sentry/utils" "6.13.2"
 | 
					    "@sentry/utils" "6.13.2"
 | 
				
			||||||
    tslib "^1.9.3"
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"@sentry/tracing@^6.13.3":
 | 
				
			||||||
 | 
					  version "6.13.3"
 | 
				
			||||||
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/tracing/-/tracing-6.13.3.tgz#ca657d4afa99c50f15e638fe38405bac33e780ee"
 | 
				
			||||||
 | 
					  integrity sha512-yyOFIhqlprPM0g4f35Icear3eZk2mwyYcGEzljJfY2iU6pJwj1lzia5PfSwiCW7jFGMmlBJNhOAIpfhlliZi8Q==
 | 
				
			||||||
 | 
					  dependencies:
 | 
				
			||||||
 | 
					    "@sentry/hub" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/minimal" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/types" "6.13.3"
 | 
				
			||||||
 | 
					    "@sentry/utils" "6.13.3"
 | 
				
			||||||
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"@sentry/types@6.13.2":
 | 
					"@sentry/types@6.13.2":
 | 
				
			||||||
  version "6.13.2"
 | 
					  version "6.13.2"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.2.tgz#8388d5b92ea8608936e7aae842801dc90e0184e6"
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.2.tgz#8388d5b92ea8608936e7aae842801dc90e0184e6"
 | 
				
			||||||
  integrity sha512-6WjGj/VjjN8LZDtqJH5ikeB1o39rO1gYS6anBxiS3d0sXNBb3Ux0pNNDFoBxQpOhmdDHXYS57MEptX9EV82gmg==
 | 
					  integrity sha512-6WjGj/VjjN8LZDtqJH5ikeB1o39rO1gYS6anBxiS3d0sXNBb3Ux0pNNDFoBxQpOhmdDHXYS57MEptX9EV82gmg==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"@sentry/types@6.13.3":
 | 
				
			||||||
 | 
					  version "6.13.3"
 | 
				
			||||||
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.13.3.tgz#63ad5b6735b0dfd90b3a256a9f8e77b93f0f66b2"
 | 
				
			||||||
 | 
					  integrity sha512-Vrz5CdhaTRSvCQjSyIFIaV9PodjAVFkzJkTRxyY7P77RcegMsRSsG1yzlvCtA99zG9+e6MfoJOgbOCwuZids5A==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"@sentry/utils@6.13.2":
 | 
					"@sentry/utils@6.13.2":
 | 
				
			||||||
  version "6.13.2"
 | 
					  version "6.13.2"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.13.2.tgz#fb8010e7b67cc8c084d8067d64ef25289269cda5"
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.13.2.tgz#fb8010e7b67cc8c084d8067d64ef25289269cda5"
 | 
				
			||||||
| 
						 | 
					@ -316,6 +383,14 @@
 | 
				
			||||||
    "@sentry/types" "6.13.2"
 | 
					    "@sentry/types" "6.13.2"
 | 
				
			||||||
    tslib "^1.9.3"
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"@sentry/utils@6.13.3":
 | 
				
			||||||
 | 
					  version "6.13.3"
 | 
				
			||||||
 | 
					  resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.13.3.tgz#188754d40afe693c3fcae410f9322531588a9926"
 | 
				
			||||||
 | 
					  integrity sha512-zYFuFH3MaYtBZTeJ4Yajg7pDf0pM3MWs3+9k5my9Fd+eqNcl7dYQYJbT9gyC0HXK1QI4CAMNNlHNl4YXhF91ag==
 | 
				
			||||||
 | 
					  dependencies:
 | 
				
			||||||
 | 
					    "@sentry/types" "6.13.3"
 | 
				
			||||||
 | 
					    tslib "^1.9.3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"@svgr/babel-plugin-add-jsx-attribute@^5.4.0":
 | 
					"@svgr/babel-plugin-add-jsx-attribute@^5.4.0":
 | 
				
			||||||
  version "5.4.0"
 | 
					  version "5.4.0"
 | 
				
			||||||
  resolved "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-5.4.0.tgz"
 | 
					  resolved "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-5.4.0.tgz"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue