From 389724fe1fbf4cb08d9abe505b8b0361b663668b Mon Sep 17 00:00:00 2001 From: Varun Date: Thu, 20 Jul 2023 11:46:34 +0545 Subject: [PATCH 1/2] feat: sentry setup for production but dev dsn missing --- src/frontend/main/package-lock.json | 164 ++++++++++++++++------------ src/frontend/main/package.json | 2 +- src/frontend/main/src/App.jsx | 20 +++- 3 files changed, 116 insertions(+), 70 deletions(-) diff --git a/src/frontend/main/package-lock.json b/src/frontend/main/package-lock.json index d1c35b1313..c7521c6a36 100644 --- a/src/frontend/main/package-lock.json +++ b/src/frontend/main/package-lock.json @@ -15,7 +15,7 @@ "@mui/lab": "^5.0.0-alpha.134", "@mui/material": "^5.11.1", "@reduxjs/toolkit": "^1.9.1", - "@sentry/browser": "^7.59.2", + "@sentry/react": "^7.59.3", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "axios": "^1.2.2", @@ -2674,13 +2674,13 @@ } }, "node_modules/@sentry-internal/tracing": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.59.2.tgz", - "integrity": "sha512-02gteChV/lMobWU06VlITq+myEWk0MzhnDCm8n/DMigB47I9HkWZFAJ+CYG6Ns0rTL+3+/c2V0bPyQkZwIC+Sg==", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.59.3.tgz", + "integrity": "sha512-/RkBj/0zQKGsW/UYg6hufrLHHguncLfu4610FCPWpVp0K5Yu5ou8/Aw8D76G3ZxD2TiuSNGwX0o7TYN371ZqTQ==", "dependencies": { - "@sentry/core": "7.59.2", - "@sentry/types": "7.59.2", - "@sentry/utils": "7.59.2", + "@sentry/core": "7.59.3", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3", "tslib": "^2.4.1 || ^1.9.3" }, "engines": { @@ -2688,15 +2688,15 @@ } }, "node_modules/@sentry/browser": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.59.2.tgz", - "integrity": "sha512-N1JiBs1VRR5DV0209TZgaMwRGiTYN1C34sFzIW7nuC82X4gHy3tuJjZPlMDTtgFrALBMJ24yQ7D4HJjXrS2+Dw==", - "dependencies": { - "@sentry-internal/tracing": "7.59.2", - "@sentry/core": "7.59.2", - "@sentry/replay": "7.59.2", - "@sentry/types": "7.59.2", - "@sentry/utils": "7.59.2", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.59.3.tgz", + "integrity": "sha512-rTsePz1zEhiouX24TqjzYdY8PsBNU2EGUSHK9jCKml5i/eKTqQabnwdxHgIC4/wcs1nGOabRg/Iel6l4y4mCjA==", + "dependencies": { + "@sentry-internal/tracing": "7.59.3", + "@sentry/core": "7.59.3", + "@sentry/replay": "7.59.3", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3", "tslib": "^2.4.1 || ^1.9.3" }, "engines": { @@ -2704,45 +2704,63 @@ } }, "node_modules/@sentry/core": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.59.2.tgz", - "integrity": "sha512-GRhoPw6b6GkvOsa060aREc9yyHjgAKITgITNbzUmn0GqIeWD5SMoCBAcENRHVgUnpQWOpnkEF1/sqxvwx+rf6Q==", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.59.3.tgz", + "integrity": "sha512-cGBOwT9gziIn50fnlBH1WGQlGcHi7wrbvOCyrex4MxKnn1LSBYWBhwU0ymj8DI/9MyPrGDNGkrgpV0WJWBSClg==", "dependencies": { - "@sentry/types": "7.59.2", - "@sentry/utils": "7.59.2", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3", "tslib": "^2.4.1 || ^1.9.3" }, "engines": { "node": ">=8" } }, + "node_modules/@sentry/react": { + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.59.3.tgz", + "integrity": "sha512-2TmJ/su8NBQad4PpyJoJ8Er6bzc1jgzgwKSYpI5xHNT6FOFxI4cGIbfrYNqXBjPTvFHwC8WFyN+XZ0K42GFgqQ==", + "dependencies": { + "@sentry/browser": "7.59.3", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3", + "hoist-non-react-statics": "^3.3.2", + "tslib": "^2.4.1 || ^1.9.3" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "react": "15.x || 16.x || 17.x || 18.x" + } + }, "node_modules/@sentry/replay": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.59.2.tgz", - "integrity": "sha512-Ma72ofTdtSinBY5GH0zM7k8o/WsdaVdPP/1iyFbcWQDt8dnrcsJVUKK0t9+8gijpiSMUKE+vjFjQNL9/PGYekw==", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.59.3.tgz", + "integrity": "sha512-o0Z9XD46ua4kex8P2zcahNLARm+joLU6e8bTwjdmfsLS/A2yH1RhJ/VlcAEpPR2IzSYLXz3ApJ/XiqLPTNSu1w==", "dependencies": { - "@sentry/core": "7.59.2", - "@sentry/types": "7.59.2", - "@sentry/utils": "7.59.2" + "@sentry/core": "7.59.3", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3" }, "engines": { "node": ">=12" } }, "node_modules/@sentry/types": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.59.2.tgz", - "integrity": "sha512-rylG7UQ0cC/xbV6trSuaAE/bsruSZy92jxQ1/KSOYKwBBvRFPXJBuiBtA81b8eYa4THZ+mE/ol2qOTJYuuV4Ug==", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.59.3.tgz", + "integrity": "sha512-HQ/Pd3YHyIa4HM0bGfOsfI4ZF+sLVs6II9VtlS4hsVporm4ETl3Obld5HywO3aVYvWOk5j/bpAW9JYsxXjRG5A==", "engines": { "node": ">=8" } }, "node_modules/@sentry/utils": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.59.2.tgz", - "integrity": "sha512-uxC8xH9wsB/tZUnjmaQ1uGtsumFOc19KWfedVHXzcNwqdt5uS3EB4+D1d8WwiJyLy2nm61DdmTC9SiB4HS+OSw==", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.59.3.tgz", + "integrity": "sha512-Q57xauMKuzd6S+POA1fmulfjzTsb/z118TNAfZZNkHqVB48hHBqgzdhbEBmN4jPCSKV2Cx7VJUoDZxJfzQyLUQ==", "dependencies": { - "@sentry/types": "7.59.2", + "@sentry/types": "7.59.3", "tslib": "^2.4.1 || ^1.9.3" }, "engines": { @@ -12790,60 +12808,72 @@ "integrity": "sha512-bkUDCp8o1MvFO+qxkODcbhSqRa6P2GXgrGZVpt0dCXNW2HCSCqYI0ZoAqEOSAjRWmmlKcYgFvN4B4S+zo/f8kg==" }, "@sentry-internal/tracing": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.59.2.tgz", - "integrity": "sha512-02gteChV/lMobWU06VlITq+myEWk0MzhnDCm8n/DMigB47I9HkWZFAJ+CYG6Ns0rTL+3+/c2V0bPyQkZwIC+Sg==", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.59.3.tgz", + "integrity": "sha512-/RkBj/0zQKGsW/UYg6hufrLHHguncLfu4610FCPWpVp0K5Yu5ou8/Aw8D76G3ZxD2TiuSNGwX0o7TYN371ZqTQ==", "requires": { - "@sentry/core": "7.59.2", - "@sentry/types": "7.59.2", - "@sentry/utils": "7.59.2", + "@sentry/core": "7.59.3", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3", "tslib": "^2.4.1 || ^1.9.3" } }, "@sentry/browser": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.59.2.tgz", - "integrity": "sha512-N1JiBs1VRR5DV0209TZgaMwRGiTYN1C34sFzIW7nuC82X4gHy3tuJjZPlMDTtgFrALBMJ24yQ7D4HJjXrS2+Dw==", - "requires": { - "@sentry-internal/tracing": "7.59.2", - "@sentry/core": "7.59.2", - "@sentry/replay": "7.59.2", - "@sentry/types": "7.59.2", - "@sentry/utils": "7.59.2", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.59.3.tgz", + "integrity": "sha512-rTsePz1zEhiouX24TqjzYdY8PsBNU2EGUSHK9jCKml5i/eKTqQabnwdxHgIC4/wcs1nGOabRg/Iel6l4y4mCjA==", + "requires": { + "@sentry-internal/tracing": "7.59.3", + "@sentry/core": "7.59.3", + "@sentry/replay": "7.59.3", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3", "tslib": "^2.4.1 || ^1.9.3" } }, "@sentry/core": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.59.2.tgz", - "integrity": "sha512-GRhoPw6b6GkvOsa060aREc9yyHjgAKITgITNbzUmn0GqIeWD5SMoCBAcENRHVgUnpQWOpnkEF1/sqxvwx+rf6Q==", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.59.3.tgz", + "integrity": "sha512-cGBOwT9gziIn50fnlBH1WGQlGcHi7wrbvOCyrex4MxKnn1LSBYWBhwU0ymj8DI/9MyPrGDNGkrgpV0WJWBSClg==", "requires": { - "@sentry/types": "7.59.2", - "@sentry/utils": "7.59.2", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3", + "tslib": "^2.4.1 || ^1.9.3" + } + }, + "@sentry/react": { + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-7.59.3.tgz", + "integrity": "sha512-2TmJ/su8NBQad4PpyJoJ8Er6bzc1jgzgwKSYpI5xHNT6FOFxI4cGIbfrYNqXBjPTvFHwC8WFyN+XZ0K42GFgqQ==", + "requires": { + "@sentry/browser": "7.59.3", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3", + "hoist-non-react-statics": "^3.3.2", "tslib": "^2.4.1 || ^1.9.3" } }, "@sentry/replay": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.59.2.tgz", - "integrity": "sha512-Ma72ofTdtSinBY5GH0zM7k8o/WsdaVdPP/1iyFbcWQDt8dnrcsJVUKK0t9+8gijpiSMUKE+vjFjQNL9/PGYekw==", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.59.3.tgz", + "integrity": "sha512-o0Z9XD46ua4kex8P2zcahNLARm+joLU6e8bTwjdmfsLS/A2yH1RhJ/VlcAEpPR2IzSYLXz3ApJ/XiqLPTNSu1w==", "requires": { - "@sentry/core": "7.59.2", - "@sentry/types": "7.59.2", - "@sentry/utils": "7.59.2" + "@sentry/core": "7.59.3", + "@sentry/types": "7.59.3", + "@sentry/utils": "7.59.3" } }, "@sentry/types": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.59.2.tgz", - "integrity": "sha512-rylG7UQ0cC/xbV6trSuaAE/bsruSZy92jxQ1/KSOYKwBBvRFPXJBuiBtA81b8eYa4THZ+mE/ol2qOTJYuuV4Ug==" + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.59.3.tgz", + "integrity": "sha512-HQ/Pd3YHyIa4HM0bGfOsfI4ZF+sLVs6II9VtlS4hsVporm4ETl3Obld5HywO3aVYvWOk5j/bpAW9JYsxXjRG5A==" }, "@sentry/utils": { - "version": "7.59.2", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.59.2.tgz", - "integrity": "sha512-uxC8xH9wsB/tZUnjmaQ1uGtsumFOc19KWfedVHXzcNwqdt5uS3EB4+D1d8WwiJyLy2nm61DdmTC9SiB4HS+OSw==", + "version": "7.59.3", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.59.3.tgz", + "integrity": "sha512-Q57xauMKuzd6S+POA1fmulfjzTsb/z118TNAfZZNkHqVB48hHBqgzdhbEBmN4jPCSKV2Cx7VJUoDZxJfzQyLUQ==", "requires": { - "@sentry/types": "7.59.2", + "@sentry/types": "7.59.3", "tslib": "^2.4.1 || ^1.9.3" } }, diff --git a/src/frontend/main/package.json b/src/frontend/main/package.json index 6c56dd0b83..30d61ec06f 100755 --- a/src/frontend/main/package.json +++ b/src/frontend/main/package.json @@ -46,7 +46,7 @@ "@mui/lab": "^5.0.0-alpha.134", "@mui/material": "^5.11.1", "@reduxjs/toolkit": "^1.9.1", - "@sentry/browser": "^7.59.2", + "@sentry/react": "^7.59.3", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "axios": "^1.2.2", diff --git a/src/frontend/main/src/App.jsx b/src/frontend/main/src/App.jsx index 4a0095a5a8..60b036834d 100755 --- a/src/frontend/main/src/App.jsx +++ b/src/frontend/main/src/App.jsx @@ -7,12 +7,28 @@ import routes from "./routes"; import { PersistGate } from "redux-persist/integration/react"; import "./index.css"; import 'react-loading-skeleton/dist/skeleton.css' -import * as Sentry from "@sentry/browser"; +import * as Sentry from "@sentry/react"; import environment from "./environment"; // import 'swiper/css'; // import 'swiper/css/navigation'; // import 'swiper/css/pagination'; -{ environment.nodeEnv !== 'development' ? Sentry.init({ dsn: environment.main_url === 'fmtm.hotosm.org' ? "https://419f6e226571489d9a767f75c7ae157f@glitchtip.naxa.com.np/6" : "https://2f6079201d4a48f8acdb1a31763e0c0d@glitchtip.naxa.com.np/4" }) : null }; +{ + environment.nodeEnv !== 'development' ? Sentry.init({ + dsn: environment.main_url === 'fmtm.hotosm.org' ? "https://35c80d0894e441f593c5ac5dfa1094a0@o68147.ingest.sentry.io/4505557311356928" : "https://35c80d0894e441f593c5ac5dfa1094a0@o68147.ingest.sentry.io/4505557311356928", + integrations: [ + new Sentry.BrowserTracing({ + // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled + tracePropagationTargets: ["localhost", "https:yourserver.io/api/"], + }), + new Sentry.Replay(), + ], + // Performance Monitoring + tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production! + // Session Replay + replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production. + replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur. + }) : null +}; ReactDOM.render( From e1ff9656e072a73c849a2f4dc637b242f8af8ef9 Mon Sep 17 00:00:00 2001 From: Varun Date: Thu, 20 Jul 2023 11:47:52 +0545 Subject: [PATCH 2/2] feat: fmtm dev and prod domain to tracepropagationtargets --- src/frontend/main/src/App.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/main/src/App.jsx b/src/frontend/main/src/App.jsx index 60b036834d..5187262bee 100755 --- a/src/frontend/main/src/App.jsx +++ b/src/frontend/main/src/App.jsx @@ -18,7 +18,7 @@ import environment from "./environment"; integrations: [ new Sentry.BrowserTracing({ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled - tracePropagationTargets: ["localhost", "https:yourserver.io/api/"], + tracePropagationTargets: ["https://fmtm.naxa.com.np/", "https://fmtm.hotosm.org/"], }), new Sentry.Replay(), ],