From 89376dd1fe6eb5e6daf9f6a12284fd6ba9dd432e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ciornavei?= Date: Fri, 8 Mar 2024 13:18:27 -0300 Subject: [PATCH] added sentry as monitoring tool on frontend --- README.MD | 2 +- frontend/package.json | 1 + frontend/src/index.tsx | 20 ++++++++++ frontend/yarn.lock | 84 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 105 insertions(+), 2 deletions(-) diff --git a/README.MD b/README.MD index 729684e..67a6919 100755 --- a/README.MD +++ b/README.MD @@ -52,7 +52,7 @@ MongoDB is being used for database. - - The frontend is cached using CloudFront. Always a deploy happens, the cloudfront cache is invalidated by CI. - ✅ Code structure and organization - - Give an special attention to page structure, each page contains a conjunction of (context, controller, view, types, styles & index) files, where each one has its own responsability, improving readability; -- ⬜ Performance and monitoring tools +- ✅ Performance and monitoring tools - - Was made use of package _`use-context-selector`_ that improves the context providing. Also, for specific cases, was created an isolated component that inherit neededs data thought context, avoiding the re-render of entire screen. ## Stategic Decisions diff --git a/frontend/package.json b/frontend/package.json index 7917c2e..bbcc2eb 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,6 +15,7 @@ "@mui/lab": "^5.0.0-alpha.167", "@mui/material": "^5.15.12", "@phosphor-icons/react": "^2.0.15", + "@sentry/react": "^7.106.0", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index cea4fca..553e19a 100755 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -2,6 +2,7 @@ import './index.css' import Router from './router' import { enableMapSet } from 'immer' import { DefaultTheme } from './theme' +import * as Sentry from '@sentry/react' import ReactDOM from 'react-dom/client' import { ApiProvider } from '@hooks/api' import { AuthProvider } from '@hooks/auth' @@ -11,6 +12,25 @@ import reportWebVitals from './reportWebVitals' import { BrowserRouter } from 'react-router-dom' enableMapSet() +// Install Sentry For Monitoring +Sentry.init({ + dsn: 'https://56ff0892b732563d22086de012c5a22c@o4506876266741760.ingest.us.sentry.io/4506876269494272', + integrations: [ + Sentry.browserTracingIntegration(), + Sentry.replayIntegration({ + maskAllText: false, + blockAllMedia: false, + }), + ], + tracesSampleRate: 1.0, + tracePropagationTargets: [ + 'localhost', + /^https:\/\/bnb-bank.andreciornavei\.com\.br/, + ], + replaysSessionSampleRate: 0.1, + replaysOnErrorSampleRate: 1.0, +}) + const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement) root.render( diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 69f702d..d023d36 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -1965,6 +1965,88 @@ resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.7.2.tgz#2d4260033e199b3032a08b41348ac10de21c47e9" integrity sha512-RbhOOTCNoCrbfkRyoXODZp75MlpiHMgbE5MEBZAnnnLyQNgrigEj4p0lzsMDyc1zVsJDLrivB58tgg3emX0eEA== +"@sentry-internal/feedback@7.106.0": + version "7.106.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/feedback/-/feedback-7.106.0.tgz#34a41f12093c09a9fec416600a11406afc60af96" + integrity sha512-Uz6pv3SN8XORTMme5xPxP/kuho7CAA6E/pMlpMjsojjBbnwLIICu10JaEZNsF/AtEya1RcNVTyPCrtF1F3sBYA== + dependencies: + "@sentry/core" "7.106.0" + "@sentry/types" "7.106.0" + "@sentry/utils" "7.106.0" + +"@sentry-internal/replay-canvas@7.106.0": + version "7.106.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/replay-canvas/-/replay-canvas-7.106.0.tgz#008c1cdc78a227ac2a84024dc79634f0c61f45bf" + integrity sha512-59qmT6XqbwpQuK1nVmv+XFxgd80gpYNH3aqgF5BEKux23kRB02/ARR5MwYyIHgVO0JhwdGIuiTfiLVNDu+nwTQ== + dependencies: + "@sentry/core" "7.106.0" + "@sentry/replay" "7.106.0" + "@sentry/types" "7.106.0" + "@sentry/utils" "7.106.0" + +"@sentry-internal/tracing@7.106.0": + version "7.106.0" + resolved "https://registry.yarnpkg.com/@sentry-internal/tracing/-/tracing-7.106.0.tgz#0752f6925c5120848c05dc6c87a60b25896f834b" + integrity sha512-O8Es6Sa/tP80nfl+8soNfWzeRNFcT484SvjLR8BS3pHM9KDAlwNXyoQhFr2BKNYL1irbq6UF6eku4xCnUKVmqA== + dependencies: + "@sentry/core" "7.106.0" + "@sentry/types" "7.106.0" + "@sentry/utils" "7.106.0" + +"@sentry/browser@7.106.0": + version "7.106.0" + resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-7.106.0.tgz#195395a9ca5a7af774eae271cea2bc08964d8abf" + integrity sha512-OrHdw44giTtMa1DmlIUMBN4ypj1xTES9DLjq16ufK+bLqW3rWzwCuTy0sb9ZmSxc7fL2pdBlsL+sECiS+U2TEw== + dependencies: + "@sentry-internal/feedback" "7.106.0" + "@sentry-internal/replay-canvas" "7.106.0" + "@sentry-internal/tracing" "7.106.0" + "@sentry/core" "7.106.0" + "@sentry/replay" "7.106.0" + "@sentry/types" "7.106.0" + "@sentry/utils" "7.106.0" + +"@sentry/core@7.106.0": + version "7.106.0" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.106.0.tgz#501aebb349014189162dc77ec31eacbf45ee44c4" + integrity sha512-Dc13XtnyFaXup2E4vCbzuG0QKAVjrJBk4qfGwvSJaTuopEaEWBs2MpK6hRzFhsz9S3T0La7c1F/62NptvTUWsQ== + dependencies: + "@sentry/types" "7.106.0" + "@sentry/utils" "7.106.0" + +"@sentry/react@^7.106.0": + version "7.106.0" + resolved "https://registry.yarnpkg.com/@sentry/react/-/react-7.106.0.tgz#84bdf925419a932376c6ab0427f7892a4db96bf1" + integrity sha512-5KMfvkBYqK990o8Ju9vsRRRR0F8TnPpZynC9YqsJYpCViKjIt8W/ysDLrU1Dj5XZyeVElZjdRlXB0aQYrwEUWg== + dependencies: + "@sentry/browser" "7.106.0" + "@sentry/core" "7.106.0" + "@sentry/types" "7.106.0" + "@sentry/utils" "7.106.0" + hoist-non-react-statics "^3.3.2" + +"@sentry/replay@7.106.0": + version "7.106.0" + resolved "https://registry.yarnpkg.com/@sentry/replay/-/replay-7.106.0.tgz#e66d78aa6a63b60a58bc78afbebf0e6ac308eea7" + integrity sha512-buaAOvOI+3pFm+76vwtxSxciBATHyR78aDjStghJZcIpFDNF31K8ZV0uP9+EUPbXHohtkTwZ86cn/P9cyY6NgA== + dependencies: + "@sentry-internal/tracing" "7.106.0" + "@sentry/core" "7.106.0" + "@sentry/types" "7.106.0" + "@sentry/utils" "7.106.0" + +"@sentry/types@7.106.0": + version "7.106.0" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.106.0.tgz#a68490c8d5f4b53f704af4c80535165e04c28e42" + integrity sha512-oKTkDaL6P9xJC5/zHLRemHTWboUqRYjkJNaZCN63j4kJqGy56wee4vDtDese/NWWn4U4C1QV1h+Mifm2HmDcQg== + +"@sentry/utils@7.106.0": + version "7.106.0" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.106.0.tgz#a4c05f79672f734c1a1475428144ab97d2f7bea9" + integrity sha512-bVsePsXLpFu/1sH4rpJrPcnVxW2fXXfGfGxKs6Bm+dkOMbuVTlk/KAzIbdjCDIpVlrMDJmMNEv5xgTFjgWDkjw== + dependencies: + "@sentry/types" "7.106.0" + "@sinclair/typebox@^0.24.1": version "0.24.51" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.51.tgz#645f33fe4e02defe26f2f5c0410e1c094eac7f5f" @@ -5394,7 +5476,7 @@ he@^1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -hoist-non-react-statics@^3.3.1: +hoist-non-react-statics@^3.3.1, 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==