feat: sentry

This commit is contained in:
2024-03-25 13:13:27 +08:00
parent 6d766da397
commit a81bb5ed53
4 changed files with 114 additions and 1 deletions

View File

@@ -21,6 +21,7 @@
"@mantine/hooks": "^7.6.2",
"@mantine/notifications": "^7.6.2",
"@reduxjs/toolkit": "^2.2.1",
"@sentry/react": "^7.108.0",
"@tabler/icons-react": "^3.1.0",
"axios": "^1.6.8",
"dayjs": "^1.11.10",

94
pnpm-lock.yaml generated
View File

@@ -17,6 +17,9 @@ dependencies:
'@reduxjs/toolkit':
specifier: ^2.2.1
version: 2.2.1(react-redux@9.1.0)(react@18.2.0)
'@sentry/react':
specifier: ^7.108.0
version: 7.108.0(react@18.2.0)
'@tabler/icons-react':
specifier: ^3.1.0
version: 3.1.0(react@18.2.0)
@@ -2425,6 +2428,91 @@ packages:
dev: true
optional: true
/@sentry-internal/feedback@7.108.0:
resolution: {integrity: sha512-8JcgZEnk1uWrXJhsd3iRvFtEiVeaWOEhN0NZwhwQXHfvODqep6JtrkY1yCIyxbpA37aZmrPc2JhyotRERGfUjg==}
engines: {node: '>=12'}
dependencies:
'@sentry/core': 7.108.0
'@sentry/types': 7.108.0
'@sentry/utils': 7.108.0
dev: false
/@sentry-internal/replay-canvas@7.108.0:
resolution: {integrity: sha512-R5tvjGqWUV5vSk0N1eBgVW7wIADinrkfDEBZ9FyKP2mXHBobsyNGt30heJDEqYmVqluRqjU2NuIRapsnnrpGnA==}
engines: {node: '>=12'}
dependencies:
'@sentry/core': 7.108.0
'@sentry/replay': 7.108.0
'@sentry/types': 7.108.0
'@sentry/utils': 7.108.0
dev: false
/@sentry-internal/tracing@7.108.0:
resolution: {integrity: sha512-zuK5XsTsb+U+hgn3SPetYDAogrXsM16U/LLoMW7+TlC6UjlHGYQvmX3o+M2vntejoU1QZS8m1bCAZSMWEypAEw==}
engines: {node: '>=8'}
dependencies:
'@sentry/core': 7.108.0
'@sentry/types': 7.108.0
'@sentry/utils': 7.108.0
dev: false
/@sentry/browser@7.108.0:
resolution: {integrity: sha512-FNpzsdTvGvdHJMUelqEouUXMZU7jC+dpN7CdT6IoHVVFEkoAgrjMVUhXZoQ/dmCkdKWHmFSQhJ8Fm6V+e9Aq0A==}
engines: {node: '>=8'}
dependencies:
'@sentry-internal/feedback': 7.108.0
'@sentry-internal/replay-canvas': 7.108.0
'@sentry-internal/tracing': 7.108.0
'@sentry/core': 7.108.0
'@sentry/replay': 7.108.0
'@sentry/types': 7.108.0
'@sentry/utils': 7.108.0
dev: false
/@sentry/core@7.108.0:
resolution: {integrity: sha512-I/VNZCFgLASxHZaD0EtxZRM34WG9w2gozqgrKGNMzAymwmQ3K9g/1qmBy4e6iS3YRptb7J5UhQkZQHrcwBbjWQ==}
engines: {node: '>=8'}
dependencies:
'@sentry/types': 7.108.0
'@sentry/utils': 7.108.0
dev: false
/@sentry/react@7.108.0(react@18.2.0):
resolution: {integrity: sha512-C60arh5/gtO42eMU9l34aWlKDLZUO+1j1goaEf/XRSwUcyJS9tbJrs+mT4nbKxUsEG714It2gRbfSEvh1eXmCg==}
engines: {node: '>=8'}
peerDependencies:
react: 15.x || 16.x || 17.x || 18.x
dependencies:
'@sentry/browser': 7.108.0
'@sentry/core': 7.108.0
'@sentry/types': 7.108.0
'@sentry/utils': 7.108.0
hoist-non-react-statics: 3.3.2
react: 18.2.0
dev: false
/@sentry/replay@7.108.0:
resolution: {integrity: sha512-jo8fDOzcZJclP1+4n9jUtVxTlBFT9hXwxhAMrhrt70FV/nfmCtYQMD3bzIj79nwbhUtFP6pN39JH1o7Xqt1hxQ==}
engines: {node: '>=12'}
dependencies:
'@sentry-internal/tracing': 7.108.0
'@sentry/core': 7.108.0
'@sentry/types': 7.108.0
'@sentry/utils': 7.108.0
dev: false
/@sentry/types@7.108.0:
resolution: {integrity: sha512-bKtHITmBN3kqtqE5eVvL8mY8znM05vEodENwRpcm6TSrrBjC2RnwNWVwGstYDdHpNfFuKwC8mLY9bgMJcENo8g==}
engines: {node: '>=8'}
dev: false
/@sentry/utils@7.108.0:
resolution: {integrity: sha512-a45yEFD5qtgZaIFRAcFkG8C8lnDzn6t4LfLXuV4OafGAy/3ZAN3XN8wDnrruHkiUezSSANGsLg3bXaLW/JLvJw==}
engines: {node: '>=8'}
dependencies:
'@sentry/types': 7.108.0
dev: false
/@sinclair/typebox@0.27.8:
resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==}
dev: true
@@ -6881,6 +6969,12 @@ packages:
space-separated-tokens: 2.0.2
dev: false
/hoist-non-react-statics@3.3.2:
resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==}
dependencies:
react-is: 16.13.1
dev: false
/hosted-git-info@2.8.9:
resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==}
dev: true

19
src/sentry.ts Normal file
View File

@@ -0,0 +1,19 @@
import * as Sentry from "@sentry/react";
Sentry.init({
dsn: "https://fee4fec58516c464f60613b40b5d3a7d@sentry.yoshino-s.xyz/2",
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
maskAllText: false,
blockAllMedia: false,
}),
],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", "ds.pages.yoshino-s.xyz"],
// Session Replay
replaysSessionSampleRate: 1.0, // 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.
});

View File

@@ -13,7 +13,6 @@ const localStorageMiddleware: Middleware = ({ getState }) => {
};
const reHydrateStore = () => {
console.log("123");
if (localStorage.getItem("applicationState") !== null) {
return JSON.parse(localStorage.getItem("applicationState") ?? "{}"); // re-hydrate the store
}