diff --git a/www/react-base/package.json b/www/react-base/package.json index 65ff72fce51b..548002b27b35 100644 --- a/www/react-base/package.json +++ b/www/react-base/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "@sentry/react": "^8.7.0", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^13.0.0", "@types/jest": "^27.0.1", diff --git a/www/react-base/src/index.tsx b/www/react-base/src/index.tsx index 9896f3bef7e0..a6e54ef15335 100644 --- a/www/react-base/src/index.tsx +++ b/www/react-base/src/index.tsx @@ -22,14 +22,32 @@ import { TopbarContext, TopbarStore } from "buildbot-ui"; -import {HashRouter} from "react-router-dom"; +import { HashRouter, createRoutesFromChildren, matchRoutes, useLocation, useNavigationType } from "react-router-dom"; import {SidebarStore} from "./stores/SidebarStore"; import { StoresContext } from './contexts/Stores'; import {globalSettings} from "./plugins/GlobalSettings"; import moment from "moment"; import axios from "axios"; +import * as Sentry from "@sentry/react"; const doRender = (buildbotFrontendConfig: Config) => { + if (buildbotFrontendConfig.sentryDSN) { + Sentry.init({ + dsn: buildbotFrontendConfig.sentryDSN, + integrations: [ + Sentry.reactRouterV6BrowserTracingIntegration({ + useEffect: React.useEffect, + useLocation, + useNavigationType, + createRoutesFromChildren, + matchRoutes, + }), + ], + // Performance Monitoring + tracesSampleRate: 1.0, // Capture 100% of the transactions + }); + } + const root = ReactDOM.createRoot( document.getElementById('root') as HTMLElement ); diff --git a/www/react-base/yarn.lock b/www/react-base/yarn.lock index e8b5cde1e23f..bb42a29fa3c5 100644 --- a/www/react-base/yarn.lock +++ b/www/react-base/yarn.lock @@ -1784,6 +1784,88 @@ dependencies: dequal "^2.0.2" +"@sentry-internal/browser-utils@8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/browser-utils/-/browser-utils-8.7.0.tgz#8a75560c80c50e023db58faf055dacde670e9d78" + integrity sha512-RFBK1sYBwV5qGMEwWF0rjOTqQpp4/SvE+qHkOJNRUTVYmfjM+Y9lcxwn4B6lu3aboxePpBw/i1PlP6XwX4UnGA== + dependencies: + "@sentry/core" "8.7.0" + "@sentry/types" "8.7.0" + "@sentry/utils" "8.7.0" + +"@sentry-internal/feedback@8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-8.7.0.tgz#fa632c70de93b9c6626951f62c732984242097d8" + integrity sha512-qcGtWCtRB4eP7NVQoxW936oPkU4qu9otMLYELPGmOJPnuAG0lujlJXW7BucaM7ADyJgJTE75hG849bHecfnbmQ== + dependencies: + "@sentry/core" "8.7.0" + "@sentry/types" "8.7.0" + "@sentry/utils" "8.7.0" + +"@sentry-internal/replay-canvas@8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-8.7.0.tgz#78316619cc57b8d81cacabacdf0f5167eb805ef9" + integrity sha512-FOnvBPbq6MJVHPduc0hcsdE3PeeovQ2z5WJnZDGhvp/Obehxqe+XgX7K/595vRIknv4EokRn/3Kw0mFwG8E+ZQ== + dependencies: + "@sentry-internal/replay" "8.7.0" + "@sentry/core" "8.7.0" + "@sentry/types" "8.7.0" + "@sentry/utils" "8.7.0" + +"@sentry-internal/replay@8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/replay/-/replay-8.7.0.tgz#2898303529bb2273129e2e86c861d03f69e95622" + integrity sha512-bQzOkWplaWTe3u+aDBhxWY3Qy0aT7ss2A3VR8iC6N8ZIEP9PxqyJwTNoouhinfgmlnCguI7RDOO4f3r3e2M80Q== + dependencies: + "@sentry-internal/browser-utils" "8.7.0" + "@sentry/core" "8.7.0" + "@sentry/types" "8.7.0" + "@sentry/utils" "8.7.0" + +"@sentry/browser@8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-8.7.0.tgz#78844ca196315327979ef7cfbad71788e95c9888" + integrity sha512-4EEp+PlcktsMN0p+MdCPl/lghTkq7eOtZjQG9NGhWzfyWrJ3tuL1nsDr2SSivJ1V277F01KtKYo6BFwP2NtBZA== + dependencies: + "@sentry-internal/browser-utils" "8.7.0" + "@sentry-internal/feedback" "8.7.0" + "@sentry-internal/replay" "8.7.0" + "@sentry-internal/replay-canvas" "8.7.0" + "@sentry/core" "8.7.0" + "@sentry/types" "8.7.0" + "@sentry/utils" "8.7.0" + +"@sentry/core@8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-8.7.0.tgz#c98bc47020cd48d899806baaebc7a4b6fe10b9ab" + integrity sha512-Sq/46B+5nWmgnCD6dEMZ6HTkKbV/KAdgaSvT8oXDb9OWoPy1jJ/gbLrhLs62KbjuDQk4/vWnOgHiKQbcslSzMw== + dependencies: + "@sentry/types" "8.7.0" + "@sentry/utils" "8.7.0" + +"@sentry/react@^8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-8.7.0.tgz#fc3f4303abb2ccd1e23f75f9f5bb6e648e095fa0" + integrity sha512-JFo8QW8JB4eaFC8RdkOBO96JvlGgstywmyMZ39qWfFbD735vGl8PnOa0AnrC/5Auc86dZ98/I4OEPboqUE9q1w== + dependencies: + "@sentry/browser" "8.7.0" + "@sentry/core" "8.7.0" + "@sentry/types" "8.7.0" + "@sentry/utils" "8.7.0" + hoist-non-react-statics "^3.3.2" + +"@sentry/types@8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-8.7.0.tgz#92731af32318d6abb8759216cf6c3c5035894e6e" + integrity sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A== + +"@sentry/utils@8.7.0": + version "8.7.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-8.7.0.tgz#26893acc5bca9bfd4998d2eafe724491e3ca78a2" + integrity sha512-aWmcbSoOmrbzll/FkNQFJcCtLAuJLvTYbRKiCSkV3FScA7UaA742HkTZAPFiioALFIESWk/fcGZqtN0s4I281Q== + dependencies: + "@sentry/types" "8.7.0" + "@sinclair/typebox@^0.23.3": version "0.23.5" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.23.5.tgz#93f7b9f4e3285a7a9ade7557d9a8d36809cbc47d" @@ -4221,6 +4303,13 @@ history@^5.2.0: dependencies: "@babel/runtime" "^7.7.6" +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== + dependencies: + react-is "^16.7.0" + hosted-git-info@^2.1.4: version "2.8.9" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" @@ -6718,7 +6807,7 @@ react-icons@^4.8.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== -react-is@^16.13.1, react-is@^16.3.2: +react-is@^16.13.1, react-is@^16.3.2, react-is@^16.7.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== diff --git a/www/react-ui/src/contexts/Config.ts b/www/react-ui/src/contexts/Config.ts index ce1e4a9dfdff..34956bdd32fe 100644 --- a/www/react-ui/src/contexts/Config.ts +++ b/www/react-ui/src/contexts/Config.ts @@ -45,6 +45,7 @@ export type Config = { titleURL: string; buildbotURL: string; buildbotURLs?: string[]; + sentryDSN?: string; multiMaster: boolean; ui_default_config: {[key: string]: any}; versions: string[][];